How can I redirect to a different page depending on what is selected on the form. For example if Cornerback and Interceptions is submitted than it should go to thirdpage.php.
Here is my code:
<!DOCTYPE html> <html> <head> <title>Nfl records</title> </head> <body> <form method="post"> Choose a postion: <select name="cars"> <option value="cb">CornerBack</option> <option value="S">Saftey</option> </select> </br> Choose a stat: <select name="stats"> <option value="int">Interceptions</option> <option value="t">Tackles</option> </select> <input type="submit" value="Submit"> </body> <?php if(isset($_POST['submit']) { $selected_val = $_POST['cars']; $selected_val2 = $_POST['stats']; if($selected_val == "cb" && $selected_val2 == "int") { header("Location: thirdpage.php"); } } ?> </form> </html>
没有评论:
发表评论