I have a dropdown list in which i have 9 options lets say (A-I). the A and B option on being clicked opens another dropdown list with a few elements whereas the remaining options should open up a new page lets say c_page.php for c, d_page.php for D and so on.
Whereas for option A and B it should open a another dropdown list (as discussed above) on which an option is chosen and then on being clicked on Next a_page.php and b_page.php.
Next button should open the desired page in every case.
I have found this similar code on stackoverflow only but it displays error: Notice: Undefined index: selectedPage
here's the code:
<form action="#" method="POST" name="theForm" id="theForm">
<select form="theForm" name="selectedPage">
<option value="page_1">Page 1</option>
<option value="page_2">Page 2</option>
</select>
<input type="submit" value="Load page" />
</form>
<?php
$requested_page = $_POST['selectedPage'];
switch($requested_page) {
case "page_1":
header("Location: page_1.php");
break;
case "page_2":
header("Location: page_2.php");
break;
default :
echo "No page was selected";
break;
}
?>
Correct this example too and also help me in developing my code.