mac007 Posted May 20, 2008 Share Posted May 20, 2008 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! Quote Link to comment https://forums.phpfreaks.com/topic/106390-solved-dynamic-dropdown-menu-doenst-write-second-word-of-a-multi-word-entry-help/ Share on other sites More sharing options...
947740 Posted May 20, 2008 Share Posted May 20, 2008 Out of curiosity, what is this?: else { $sel = ''; } Should there not be two "? Quote Link to comment https://forums.phpfreaks.com/topic/106390-solved-dynamic-dropdown-menu-doenst-write-second-word-of-a-multi-word-entry-help/#findComment-545356 Share on other sites More sharing options...
mac007 Posted May 20, 2008 Author Share Posted May 20, 2008 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>"; Quote Link to comment https://forums.phpfreaks.com/topic/106390-solved-dynamic-dropdown-menu-doenst-write-second-word-of-a-multi-word-entry-help/#findComment-545374 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.