New to PHP
Posted: Wed Mar 25, 2009 10:48 am
Hi
First off i just want to point out i am quite new to php. I have a simple html form that has a text box called username and a submit button.When the submit button is pressed it actions a piece of php code.
What i want to do is,
if the user types in a number greater than or equal to 15000 or less than or equal to 150000, then they need to be directed to redirect page.
if the user types in a number greater than 150000 or less than or equal to 250000, then they need to be directed to redirect page2.
if the user types in a number greater than 250000, then they need to be directed to redirect page3.
For some reason i keep getting redirected to redirect page, not the relevant one for the numbers entered.
Apologies if this is really simple and im missing something obvious. Any help will be much appreciated i have been trawling the web for ages without much luck
First off i just want to point out i am quite new to php. I have a simple html form that has a text box called username and a submit button.When the submit button is pressed it actions a piece of php code.
Code: Select all
<?PHP
$username = $_POST['username'];
$redirect_page='http://www.mydomain.com/prices.htm';
$redirect_page2='http://www.mydomain.com/prices2.htm';
$redirect_page3='http://www.mydomain.com/prices3.htm';
if ($username >= "0" || $username <= "150000") {
header('Location: '.$redirect_page);
}
elseif ($username > "150000" || $username <= "250000") {
header('Location: '.$redirect_page2);
}
elseif ($username >= "250000") {
header('Location: '.$redirect_page3);
}
exit;
?>if the user types in a number greater than or equal to 15000 or less than or equal to 150000, then they need to be directed to redirect page.
if the user types in a number greater than 150000 or less than or equal to 250000, then they need to be directed to redirect page2.
if the user types in a number greater than 250000, then they need to be directed to redirect page3.
For some reason i keep getting redirected to redirect page, not the relevant one for the numbers entered.
Apologies if this is really simple and im missing something obvious. Any help will be much appreciated i have been trawling the web for ages without much luck