PHP Drop down list from databases

HI all.

I am trying to populate a drop down from two separate sources.

The page is used for editing data so I want the current data in the drop down and the ist is populated from another table. I can get this to work but my form is not passing the data to write back to the database.
My problem is that I am calling from two sources therefore my strings are different.

Snippet of code to help.

[php]While ($r = mysql_fetch_array($result)) {
$code = $r[“code”];
$desc = $r[“desc”];
$val = $r[“val”];
$com1 = $r[“com1”];
$com2 = $r[“com2”];
$com3 = $r[“com3”];
$dateadd = $r[“dateadd”];
$dateup = $r[“dateup”];
$user = $r[“user”];

$options1 = ‘’;
$filter1=mysql_query(“select distinct temp from temp”);
while($row1 = mysql_fetch_array($filter1)) {
$options1 .="" . $row1[‘temp’] . “”;
}

echo $search_results .= "

[/php]

I know this is not current code, but its what I am working with.

Thank you all in advance for you help.[/code]

ID: $id <input type='hidden' name='id' value='$r[id]'
Product code:
Description:
Value:
Temperature: $com1 $options1

When you say “The Form is not passing the data to write back to the database”

I see that you are posting the data back to a form called “updaterecord.php”, can you post the code to updaterecord.php where you are attempting to write back to the database.

I been over this a few times only to realise that I had gotten the select name completely wrong.

Sometimes helps to put something down for a few days and then come back to it later on.

Note to self. Think things through logically !

Sponsor our Newsletter | Privacy Policy | Terms of Service