Forum Moderators: coopster

Message Too Old, No Replies

dropdown posting blank value

         

bodycount

3:51 pm on May 26, 2006 (gmt 0)

10+ Year Member



I am using the following to populate a drop down list whichs seems to work fine but when I use this in a form and post the data to the database it is posting a blank field.

<select name="COMPANY_id">
<option></option>
<?php
$query1 = "SELECT DISTINCT COMPANY_id FROM addresses ORDER BY COMPANY_id DESC";
$result1 = mysql_query($query1);
$num_rows=mysql_num_rows($result1);
while ($row=mysql_fetch_array($result1))
{
$COMPANY_id = $row["COMPANY_id"];
echo "<option value=\"$COMPANY_id\">$COMPANY_id</option>";
}
echo "</select><br>";
?>
*************************************************

Here is the full script.

<snipped excessive code per Posting Guidelines [webmasterworld.com]>

[edited by: coopster at 4:11 pm (utc) on May 26, 2006]
[edit reason] excessive code [/edit]

bodycount

4:00 pm on May 26, 2006 (gmt 0)

10+ Year Member



Never mind

I was beening a n00b I move the declared names to the wrong place if should be in the bottom php.