Referring to this example PHP form that loads content based on dropdown option
Solution 1, PHP
1) index form
<form action="loadPage.php" 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>
2) A PHP handler
<?php
//loadPage.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;
}
?>
I just want to do It without the need of clicking on submit. I want to achieve this just by clicking on the dropdown list value then checks if it's equal to the value in the Php file if yes show the page.
Thanks a lot.