carefree Posted July 9, 2007 Share Posted July 9, 2007 Heres a challenge: Im trying to create a "Select all" search Option dropdown form , but the options are stored the the database. Heres my original form: <option value="<? echo $rst["id"]; ?>"><? echo $rst["cat_name"]; ?></option> Basicly it has 20 or so options, but no "search all" option. I had a play and came up with this but its adding the "select all" option every 2nd field: <option value="<? echo $rst["id=all"]; ?>">All Categories</option> <option value="<? echo $rst["id"]; ?>"><? echo $rst["cat_name"]; ?></option> Can anyone help? Link to comment https://forums.phpfreaks.com/topic/59039-solved-select-all-option-dropdown/ Share on other sites More sharing options...
BillyBoB Posted July 9, 2007 Share Posted July 9, 2007 can i see the full coding you have now? Link to comment https://forums.phpfreaks.com/topic/59039-solved-select-all-option-dropdown/#findComment-293068 Share on other sites More sharing options...
carefree Posted July 9, 2007 Author Share Posted July 9, 2007 can i see the full coding you have now? Here it is:) <form name="form2" method="post" action="showcategory.php"> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="17%"><FONT color=#000000><strong><font color="#000000" size="2" >SEARCH</font></strong></FONT></td> <td width="31%"><input type="text" name="keyword"></td> <td width="24%"><select name="cid"> <? $cats=mysql_query("select * from sbwmd_categories where pid=0"); while($rst=mysql_fetch_array($cats)) { ?> <option value="<? echo $rst["id=all"]; ?>">All Categories</option> <option value="<? echo $rst["id"]; ?>"><? echo $rst["cat_name"]; ?></option> <? }//end while ?> </select></td> <td width="28%"><input type="submit" name="Submit2" value="Go" class="input"></td> </tr> </table> </form> Link to comment https://forums.phpfreaks.com/topic/59039-solved-select-all-option-dropdown/#findComment-293071 Share on other sites More sharing options...
BillyBoB Posted July 9, 2007 Share Posted July 9, 2007 next time please use the bbcode Code tag please its the # button when you post <form name="form2" method="post" action="showcategory.php"> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="17%"><FONT color=#000000><strong><font color="#000000" size="2" >SEARCH</font></strong></FONT></td> <td width="31%"><input type="text" name="keyword"></td> <td width="24%"><select name="cid"><option value="all">All Categories</option> <? $cats=mysql_query("select * from sbwmd_categories where pid=0"); while($rst=mysql_fetch_array($cats)) { ?> <option value="<? echo $rst["id"]; ?>"><? echo $rst["cat_name"]; ?></option> <? }//end while ?> </select></td> <td width="28%"><input type="submit" name="Submit2" value="Go" class="input"></td> </tr> </table> </form> Link to comment https://forums.phpfreaks.com/topic/59039-solved-select-all-option-dropdown/#findComment-293078 Share on other sites More sharing options...
carefree Posted July 9, 2007 Author Share Posted July 9, 2007 Thanks for that!! I was looking in the wrong section :-\, it work beutifully Link to comment https://forums.phpfreaks.com/topic/59039-solved-select-all-option-dropdown/#findComment-293080 Share on other sites More sharing options...
BillyBoB Posted July 9, 2007 Share Posted July 9, 2007 Your welcome please mark this post as resolved found on the bottom of the page Link to comment https://forums.phpfreaks.com/topic/59039-solved-select-all-option-dropdown/#findComment-293082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.