<form id="form1" name="form1" method="post" action="foo.php">
sort by:
<select>
<option name="date">sort by date</option>
<option name="name">sort by name</option>
<option name="price">sort by price</option>
</select>
</form>
What I want here is that when I select an option the action in the form will be automatically executed? so in short
what I select will be send in foo.php thru $_POST. I dont want input button to make the action executed.
Do I need Javascript to achieve this?
Can you show me code to do this?
if it needs javascript then how
You need javascript for that.
Although you should use unobtrusive javascript, the basic code looks something like:
You attach an event handler to the
changeevent and have it submit the form.