View Full Version: Anyone had this problem with PHP?

Fake2knet > programming & scripting > Anyone had this problem with PHP?



Title: Anyone had this problem with PHP?
Description: IF statements not working


iceklown - April 22, 2008 08:19 PM (GMT)
I have a friends site that was working for 2 years on my old unix web server, and we moved to a Windows server a few months ago.

The server HAS php support, however, in one of his pages when you go to http://www.blalblahblah.com/gallery.php?x=select

its supposed to show the code in the IF statement below which is at the near top of the page...

if ($x == "select")
{
print("Gallery Selection");
print("Other HTML Here");
}
else
{
print("Error");
}

When I go to the page, it shows up fine, no php errors, the INCLUDE() functions work fine, but everything in that IF statement doesnt show up.

anyone else had this problem before?

mickygor - April 24, 2008 12:46 PM (GMT)
Try replacing $x with $_GET['x']

iceklown - April 24, 2008 01:47 PM (GMT)
I tryed that already, nothing.

I was playing with other peices of the pages code and I found alot more problems :-/ guess Ill have to just re-write the damn thing.

Feldor - June 6, 2008 03:35 PM (GMT)
print_r($_REQUEST)

do that to check make sure that the variable is being passed and to where, and you should probubly be checking for the variable before anything such as this:

CODE
if(isset($_GET['x'])) {
  $x = $_GET['x'];
} else {
  print('Error');
  // Or you could set it to a default value $x = 'view';
}


something like that..




Hosted for free by InvisionFree