problem with $_GET or $_POST in xampp for windows

Problems with the Windows version of XAMPP, questions, comments, and anything related.

problem with $_GET or $_POST in xampp for windows

Postby matijaz74 » 12. May 2011 16:06

Hi!
I have a problem.
Simple code:

Code: Select all
<?php
 if($_GET["p"]!=""){
 }
?>


I have install xampp version 1.7.4. What is wrong or why?
Thanks for help me.

Matijaž
matijaz74
 
Posts: 2
Joined: 12. May 2011 14:14

Re: problem with $_GET or $_POST in xampp for windows

Postby Altrea » 12. May 2011 16:38

Maybe it is easier to help you if you tell us, what exactly your problem is.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: problem with $_GET or $_POST in xampp for windows

Postby matijaz74 » 12. May 2011 17:07

Altrea wrote:Maybe it is easier to help you if you tell us, what exactly your problem is.


Uppss ... sorry :)

This is problem:
Code: Select all
Notice: Undefined index: p in C:\xampp\htdocs\vsiza.si\testi\durs\index.php on line 10
matijaz74
 
Posts: 2
Joined: 12. May 2011 14:14

Re: problem with $_GET or $_POST in xampp for windows

Postby Altrea » 12. May 2011 23:47

Well, "p" isn't set in your $_GET Array at this point which is a little bit sloppy programming style if you don't check that.
use the php functions isset() or empty() to check if a variable or Array key is set or empty

change
Code: Select all
if($_GET["p"]!=""){


to
Code: Select all
if(isset($_GET["p"]) && $_GET["p"] !=""){


and your Notice is gone.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 115 guests