How to pass value from <option><select> to form action

mr.data1 picture mr.data1 · Jan 4, 2013 · Viewed 109.5k times · Source

I need to pass a value in option select to action where I have agent_id=

Can anyone help?

<form method="POST" action="index.php?action=contact_agent&agent_id=">
<select>
<option value="1">Agent Homer</option>
<option value="2">Agent Lenny</option>
<option value="3">Agent Carl</option>
</select>

Answer

Shoaib picture Shoaib · Mar 5, 2015

You don't have to use jQuery or Javascript.

Use the name tag of the select and let the form do it's job.

<select name="agent_id" id="agent_id">