Hi All,
I created a dynamic drop down menu that pulls data from a mysql DB. It works fine but when I select a 2 word choice from the menu...only the first word is put into the DB.

Example...if I chose "Smith Security" only the word "Smith" would be entered into the table.

I did some Googling and found something about htmlentities but I'm not sure how to apply or if that will fix the problem.

Code for drop down is below.

Thanks for any advice.

<?php
$result = mysql_query("SELECT company_name FROM CLIENTS");

echo "<select name='company_name'id='company_name'></option>";

while($num=mysql_fetch_array($result)){

echo "<option value=$num[company_name]>$num[company_name]</option>";

}
echo "</select>";?>

    You need to quote the value:

    echo "<option value='$num[company_name]'>$num[company_name]</option>";
    

    Or, since the display value is the same as the option tag value, you can omit the value attribute:

    echo "<option>$num[company_name]</option>";
    

      Thanks for the help NogDog!

      Worked great!

        Write a Reply...