Jump to content

[SOLVED] Dynamic Dropdown menu doenst write second word of a multi-word entry- help...!


mac007

Recommended Posts

Hello, there.. have a problem with my dropdowm menu... tried to look on past posts but didnt see anythin on it.

 

Anyways, problem is my "select"  dropdown menu doesnt "write" all words in a multi-word entry. Per example, the menu gets dynamically populated from a list of cities-categories, in which some of these names like "Buenos Aires" or "Mar del Plata" are made of several words. So, when I try to insert new item, the menu populates just fine and shows as "Buenos Aires" but when I hit "insert" the new item only keeps the "Buenos" and disegards the second word... it does this for all multi-word entries...

 

Here is the "select" menu code:

 

 

 

<SELECT name="city" id="city">
                        <?php

$query=("select * from item_subcategory order by city_name, city_name desc");

$result=mysql_query($query) or die ("Unable to Make the Query:" . mysql_error() ); 

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

if ($row['city_name'] == $item['city']) {
$sel = 'SELECTED ';
}
else {
$sel = '';
}

echo "<OPTION " . $sel . "VALUE=".$row['city_name'].">".$row['city_name']."</OPTION>";
}
?>
                      </SELECT>

 

Anyw help much appreciated...

 

Thanks!

I am assuming that's the $variable to deffault to normal menu, as opposed to pre-selecting an entry... soembody else helped on that specific part, so all I caqn give u is general info on that...

 

by the way, for good of everybody I fixed the problem on the cutting of words in menu, needed to enclose in quotes:

 

echo "<OPTION " . $sel . "VALUE='".$row['city_name']."'>".$row['city_name']."</OPTION>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.