POSTing after user chooses from dropdown
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开发者_C百科.php
How can this be done?
http://pastebin.com/Lr4a8KMq
<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.
精彩评论