Watson Tan
New member
I want to make a redirect page with options in a combo box. Where I select the site from the box, and then click Redirect! and then it'll redirect to that site but I'm getting a parse error in line 3 in the php file. This is that line: if($_POST['site'] == "google")
My code:
<body>
<form method = "POST" action = "redirectphp.php">
<p style = "font-weight:bold; font-size: 34pt"> Redirect to Websites </p>
Please select the site you want to redirect to: <br />
<select name = "site">
<option value = "google"> Google </option>
<option value = "yahoo"> Yahoo </option>
<option value = "bing"> Bing </option>
<option value = "wikipedia"> Wikipedia </option>
<option value = "espn"> ESPN </option>
</select>
<input type = "submit" value = "Redirect!"/>
</form>
</body>
PHP Part:
<?php
$web = $_POST['site']
if($_POST['site'] == "google")
{
header('Location: http://www.google.com/');
}
?>
My code:
<body>
<form method = "POST" action = "redirectphp.php">
<p style = "font-weight:bold; font-size: 34pt"> Redirect to Websites </p>
Please select the site you want to redirect to: <br />
<select name = "site">
<option value = "google"> Google </option>
<option value = "yahoo"> Yahoo </option>
<option value = "bing"> Bing </option>
<option value = "wikipedia"> Wikipedia </option>
<option value = "espn"> ESPN </option>
</select>
<input type = "submit" value = "Redirect!"/>
</form>
</body>
PHP Part:
<?php
$web = $_POST['site']
if($_POST['site'] == "google")
{
header('Location: http://www.google.com/');
}
?>