Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple PHP Code works locally but not remotely

Status
Not open for further replies.

Mickbw

Programmer
Jul 9, 2001
84
US
Hi,

This PHP file displays correctly when I run it locally but not when I run it on my web site. I did do a page with phpinfo() remotely so I know it is parsing.

I have a simple PHP form with a GET Method located at where I can place values in the Radio Buttons and Check Boxes and the values display a URL as such.

It will not show the GET values when I run the following code:

Code:
<?php

$Flavor = '123';
echo $Flavor;
$Flavor = $_GET['IceCream'];


echo $Flavor;
switch ($Flavor)
{
  case 1:
    echo &quot;<img src='van.gif'>&quot;;
	$Vehicle = 'Van';
    break;
  case 2:
    echo &quot;<img src='bus.gif'>&quot;;
	$Vehicle = 'Bus';
    break;
  case 3:
    echo &quot;<img src='plane.jpg'>&quot;;
	$Vehicle = 'Plane';
    
	break;
  
}


echo '<h1>Enjoy your new ';
echo $Vehicle ;
echo '.';
echo'<br>';
echo '<h2>This Model Features:<br>';
$Topping1 = $_GET[&quot;Horn&quot;];


if ($Topping1 <> '')
{echo $Topping1,'<br>';}
$Topping2 = $_GET[&quot;Belts&quot;];
if ($Topping2 <> '')
{echo $Topping2,'<br>';}
$Topping3 = $_GET[&quot;Radio&quot;];
if ($Topping3 <> '')
{echo $Topping3,'<br>';} 
$Topping4 = $_GET[&quot;Door&quot;];
if ($Topping4 <> '')
{echo $Topping4,'<br>';}
$Topping5 = $_GET[&quot;Brakes&quot;];
if ($Topping5 <> '')
{echo $Topping5,'<br>';}
echo '</h2>'
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>

</body>
</html>

I know this is probably very simple so your help is greatly appreciated.

Michael
 
My Local PHP is 4.30
The Server PHP in 4.06.

If I understand your reply, that would mean that $_POST['MYVAR'] AND $_GET['MYVAR'] would not work on the server?

What could I use to get the values ?

Thanks for your assistance,

Michael
 
One &quot;gotcha&quot; using $HTTP_[GET|POST]_VARS. They aren't superglobal, so their values will not be available in other variable scopes, such as inside a fuction. You'll have to perform &quot;global $HTTP_GET_VARS;&quot; to make the values available in a function.

There are lots of improvements and bug-fixes between 4.0.6 and 4.3.0. I don't suppose it's possible to upgrade the PHP installation on the server, is it? Want the best answers? Ask the best questions: TANSTAAFL!
 
That solved my problem.

Thank you for all your help.

Now I can finally get some sleep.

Thanks,

Michael
 
The 4.06 install is on an ISP. I will send them a note to ask when they are planning to upgrade.

Once again Thanks for your help. It was driving me crazy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top