MartinTheNob MartinTheNob - 8 months ago 49
HTML Question

Extract html input with php

I am new to php and want to make a dropdown menu where you can select a site that you want, then when you click a button you will be redirected to that site. The button will take you to for example "" if that is what you select, if you select "" the same button will take you there. I currently have no working php code as I am not sure where to start. I will include the html code below.

<form method="post" action="testttt.php">
<select id="mySelect" onchange="myFunction()">
<option value="SelectSite"> Select Site Please
<option value="Itslearning"> Itslearning
<option value="NDLA"> NDLA

<input type="submit" value="GO"/>

The form ends a bit further down, so please don't complain about there being no :P ANY HELP IS APPRECIATED :)


Try the below code , i have done the example which you want and its work perfectly . You can do it this in single file as i have done .


    $options = $_POST["testing"];
    header('Location: '.$options.'');
    echo "Your option value".$options;

<form method="post" action="#">
<select id="mySelect" name="testing" onchange="myFunction()">  
    <option value="SelectSite"> Select Site Please
    <option value=""> Itslearning
    <option value=""> NDLA

    <input type="submit" name="btnsubmit" value="GO"/>