Hi,

> I have a drop-down menu that has been prepopulated with an array from a
> column name CompanyName. What I need to do is take the CompanyName lookup
> the CompanyID in the company table and insert the CompanyID into a row in
a
> table called contacts with a CompnayID column.
[...]
Is this a multiple or a single select?

A quick and dirty thought:
<?php
$sql and $query as they were

echo "<select name=\"company\">";

while ($row = mysql_fetch_array($query)) {

echo "<option value=\"$row['CompanyID']\">$row['CompanyName']</option>";

// I didn't get the if-else statement you had here before. I think it is
better to have
// the id as the value and not the name.

}
?>

So if the from (which I assume you are using) is submitted you have $company
with
the CompanyID as its value which then can be inserted. If it is a multiple
select you
have to do it with an array but shouldn't be too tricky either

hope it helps
Johannes





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to