Big bug with $_GET

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

Re: Big bug with $_GET

Postby jeggy » 09. February 2011 01:33

i got the same error, i have tried re install xampp and i have tried reinstall ubuntu many times.... please anyone who got it to work tell me how?
this is the only reason im not sure i want linux
jeggy
 
Posts: 3
Joined: 09. February 2011 01:30

Re: Big bug with $_GET

Postby Altrea » 09. February 2011 15:13

jeggy wrote:i got the same error

Which error?
There are several different error messages in this post.

Try again and give us as much information as possible you have about your error.
Post the full error message here, too.
And Post where you have the XAMPP install from and how you have installed it.
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: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Big bug with $_GET

Postby jeggy » 09. February 2011 16:01

code:
Code: Select all
<?php
$a = $_GET['u'];
echo $a;
?>

Notice: Undefined index: u in /opt/lampp/htdocs/index.php on line 2

on http://localhost/index.php , but when it is http://localhost/index.php?u=abc it works and print out "abc"

i downloaded it from http://www.apachefriends.org/en/xampp-linux.html#374
and followed the steps there..
jeggy
 
Posts: 3
Joined: 09. February 2011 01:30

Re: Big bug with $_GET

Postby Altrea » 09. February 2011 16:42

jeggy wrote:on http://localhost/index.php , but when it is http://localhost/index.php?u=abc it works and print out "abc"

Thats the correct behavior of php. What do you think is wrong with that?

If you want to use a variable or index and you don't know, if it is setted or not at this point, use the php functions isset() or empty() with it

Code: Select all
<?php
if(isset($_GET['u'])) {
    $a = $_GET['u'];
} else {
    $a = 'foo';
}
echo $a;
?>
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: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Big bug with $_GET

Postby jeggy » 10. February 2011 15:23

i didn't get that error on xampp in windows or on my site.
is there any way that i can install something to get it to work?
jeggy
 
Posts: 3
Joined: 09. February 2011 01:30

Re: Big bug with $_GET

Postby Altrea » 10. February 2011 16:21

"but my script is working fine on my online host" is a bad answer.
It just works there without this Notice because the Error Reporting Level of your Host is setted to a less strict setting.

Set your error_reporting online to E_ALL and you will get the same notices as ob your development environment.
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: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Previous

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 6 guests