I'm searching a way to retrieve an ID corresponding to a 'select' without execute any other query when I select an item from Database:
I use the select item in a form.
Here is the way I select some names from a table from Database:
$sql = "SELECT ID, Name,Surname FROM Table;";
$result = mysql_query($sql);
if(!$result) die ('Unable to run query:'.mysql_error());
$la = "<SELECT name='names'>";
$la .= "<OPTION selected='selected' disabled='disabled' >Choose a name</OPTION>";
while(list($id, $name) = mysql_fetch_row($result)) {
$selectnames .= "<OPTION >$name</OPTION>";
}
$selectnames .= "</SELECT>";
I want to know the ID corresponding to the '$selectnames' I select from a form,
Thanks!