Jump to content

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


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>";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.