goto URL
Posted: Thu Nov 06, 2008 1:36 pm
Good afternoon,
I am new to the PHP lang all together.
I am wondering if anyone can help me out?
What I am trying to do is, on my index page have users answer the question of what their location is.
Then, pass this information off to location.php where it will direct the user to one of two web pages.
Any Ideas? and Thank you in advance,
Brian
index.html
<html>
<head></head>
<body>
<h2>Please Select Your Location</h2>
<p>
<form method="get" action="location.php">
<select name="location">
<option value="1">Ontario - Canada
<option value="2">Other Provinces - Canada
</select>
<input type="submit" value="Send">
</form>
</body>
</html>
location.php code
<?php
// get form selection
$location = $_GET['location'];
// check value and select appropriate item
if ($location == 1) {
$special = 'Location: http://www.url_A.com';
}
elseif ($location == 2) {
$special = 'Location: http://www.url_B.com';
}
?>
<?php header( $special); ?>
I am new to the PHP lang all together.
I am wondering if anyone can help me out?
What I am trying to do is, on my index page have users answer the question of what their location is.
Then, pass this information off to location.php where it will direct the user to one of two web pages.
Any Ideas? and Thank you in advance,
Brian
index.html
<html>
<head></head>
<body>
<h2>Please Select Your Location</h2>
<p>
<form method="get" action="location.php">
<select name="location">
<option value="1">Ontario - Canada
<option value="2">Other Provinces - Canada
</select>
<input type="submit" value="Send">
</form>
</body>
</html>
location.php code
<?php
// get form selection
$location = $_GET['location'];
// check value and select appropriate item
if ($location == 1) {
$special = 'Location: http://www.url_A.com';
}
elseif ($location == 2) {
$special = 'Location: http://www.url_B.com';
}
?>
<?php header( $special); ?>