I have a empty select box on a form.
<select id='essentialDocs[]' ></select>
through some script i add options to it. Basically it adds URL’s. So at runtime html will look
like
<select id='essentialDocs[]' >
<option value='http://www.google.com' title='Google'>Google</option>
<option value='http://www.yahoo.com' title='yahoo'>Yahoo</option>
</select>
Now on submitting the form i want to get both of these key:value pairs
like Title:URL google:http://www.google.com
but on doing $_POST['essentialDocs'] i only get values and not title’s. What modification would help get me both. Also another thing i have on the form is i can switch the ordering of url’s on screen. Please suggest some solution
Try this. This may help you..
Just add title in value with : When you submit you get your desire value.
Print post array in PHP
Output:
Now you can get both title and URL.