Reputation: 423
I want to redirect the page on the if condition.
this is my html page
<form name="frmpayment" enctype="application/x-www-form-urlencoded" action="payment_mode.php" method="POST">
<table>
<tr>
<td><label for="mode">Select Mode</label></td>
<td>
<select name="selectmode" id="slctmode" size="1">
<option selected>Selected Mode</option>
<option value="1">Online Payment</option>
<option value="2">Cash on Delevery</option>
</select></td></tr>
<tr><td></td><td>
<input type="submit" name="btnmode" value="Done"/>
</td></tr></table>
</form>
and this is my payment_mode.php page
<?php
$i= $_POST['selectmode'];
if($i>1)
{
header("Location : detail.php");
}
else
{
header("Location : home.php");
}
?>
bt it does not redirect the page detail.php and home.php
Upvotes: 3
Views: 298
Reputation: 30565
Try:
<?php
$i= $_POST['selectmode'];
if($i>1)
{
header("Location: detail.php");
exit;
}
else
{
header("Location : home.php");
exit;
}
Also, make sure on this page there is nothing being outputted before your calling the header()
function.
Upvotes: 1