I cannot figure out how to POST the option the user chooses from the drop down list that’s named “Drop”.
Whichever option the user chooses when they click submit, I want it to POST the drop down list’s value to something.php
So for example if the user chooses Monthly or Hourly, it should post “Hourly” or “Monthly” to something.php
How can this be done?
<select id="mySelect" name="Drop" class="testingStyles">
<option>Month</option>
<option>Week</option>
<option>Day</option>
<option>Hour</option>
</select>
<input type="button" class="formbutton" onclick="getIndex()" value="Alert index of selected option">
<br/>
<br/>
<form Method ="POST" action="something.php">
<div id="numbers">
</div>
<input type="submit" style="width: 75px; border: 1px solid gray" class="formbutton" value="Submit">
</form>
The problem is that the drop-down is not part of the
<form>element. Move the form’s start tag up to include the drop-down.Move
<form Method="POST" action="something.php">to above the<select>tag.