Please help, drag additional value from mysql

A

Anonymous

Guest
Ok, heres the problem.

I have a dropdown list that drags my model names from my database into it:

$Query = "SELECT * FROM model";
$Result = mysql_db_query ($DBName, $Query, $Link);
print ("<form method='get' action='$self'>");

print ("<select name='model' $form_pres>");
print ("<option selected value=''>");

while ($Row = mysql_fetch_array ($Result)) {
print ("<option value='$Row[dbModelName]'>$Row[dbModelName]");
}

print (" <input type='submit' value='select'>");
print ("</form>");


When the model name is selected and the form submitted I want to take an additional value across from the database (dbModelId) using a hidden form element.

How do I do this?? I have thought about it and cannot figure out a solution.

Thanks for you time and help, its much appreciated!

:D :) :( :eek: :lol: 8) :lol: 8) :x :p :oops: :cry: :wink: :roll: :twisted: :evil: :!: :?: :idea: :arrow:
 
When you set the value of the drop downs make them the ID (dbModelId), and then when you need the Database name use $Query = "SELECT * FROM model where dbModelId = $value" where $value = 'model' $form_pres.

Then the usual query and fetch array.

Code:
$Row = mysql_fetch_array ($Result))

Now you have both the model name and the ID in the $Row[]. I hope this answers your question.
 
Back
Top