brown2005 Posted November 10, 2006 Share Posted November 10, 2006 echo" <select name='a' class='text'>";echo" <option value=''> </option>"; $current_price = ""; while ($row = mysql_fetch_array($query, MYSQL_ASSOC)) { if($row['a'] != $current_price) {echo" <option value=''>".$row['a']."</option>"; $current_price = $row['a']; }echo' <option value="'.$row['b_id'].'">'.$row['b'].' ( '.$row['b_number'].')</option>'; }echo" </select>";hi i have the above that prints a select box and inside itcomes out with[b]A[/b]applespairs[b]B[/b]bannasbut i want a space after every letter so;[b]A[/b]applespairs[b]B[/b]bannasne ideas please? Link to comment https://forums.phpfreaks.com/topic/26825-a-to-z-in-combo-box/ Share on other sites More sharing options...
blear Posted November 10, 2006 Share Posted November 10, 2006 One problem with using array indices what are one letter long, is that when the next person to look at your code has trouble understanding it.Looking at the code, I dont see what is outputting which line. But, I would suggest putting[code] echo "<option value=' '> </option>"; [/code]Immediately prior to whichever line outputs the bold-type letter. Then, you eliminate the second line which adds the first (and now superfluous) blank line. Link to comment https://forums.phpfreaks.com/topic/26825-a-to-z-in-combo-box/#findComment-122687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.