PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
leegee3
Forum Newbie
Posts: 10 Joined: Thu Mar 29, 2007 7:28 am
Post
by leegee3 » Mon May 07, 2007 3:05 pm
Again, I am a beginner at php and html so please go easy on me
I have a php file that has the following code...
Code: Select all
<?php
if($location != null)
{
header("Location:$location");
exit();
}
?>
<html><head><title> Redirect </title></head>
<body>
Please select a site:
<form action="<?php $PHP_SELF?>" method="post">
<select name="location">
<option value="http://www.google.com"> Google </option>
<option value="http://www.iii.co.uk"> Interactive Investor </option>
<option value="http://www.myspace.com"> Myspace </option>
<option value="http://www.facebook.com"> Facebook </option>
</select>
<input type="submit" name="submit" value="GO">
</form>
</body>
</html>
The page displays all of the options available in a dropdown list but when I click on the go button it does not take me to the appropriate page. Global Registers are turned off if that makes any difference!!
Any ideas???
Thanks Lee
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue May 08, 2007 9:02 am
If register globals is off, $location will not be set automatically. You need to set it for PHP.
You also should not be using $PHP_SELF. Partly because register globals is off, but more importantly because it's a security hazard.
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Tue May 08, 2007 9:04 am
repost...locked