jonw118 Posted May 19, 2008 Share Posted May 19, 2008 Hey there- quick question... I'd really appreciate any help. I have a dropdown box that displays in the admin side of my site... but instead of having it as a dropdown, I want it to just print what currently shows as selected (I don't want it to show the actual dropdown). Is there something quick I can do in here to make this happen: <?php $catOption=$object->allowed_user_category($_SESSION["my_adminid"]); if($catOption==0){ ?> <select id="catID" name="catID"> <option value="" SELECTED>Please Choose............</option> <?php $rs=mysql_query("select * FROM tbl_category "); while($row=mysql_fetch_array($rs)){ ?> <option value="<?php echo $row["cat_ID"]?>"<?php if($row["cat_ID"]==$rowListing["cat_ID"]) echo "selected"?>><?php echo $row["cat_descp"]?></option> <?php }?> </select> <?php } else{ ?> <?php } ?> THANKS! Quote Link to comment https://forums.phpfreaks.com/topic/106324-convert-a-dropdown-to-text/ Share on other sites More sharing options...
DeanWhitehouse Posted May 19, 2008 Share Posted May 19, 2008 if i am right it should be this to do it <?php $catOption=$object->allowed_user_category($_SESSION["my_adminid"]); if($catOption==0){ ?> <select id="catID" name="catID"> <option value="" SELECTED>Please Choose............</option> <?php $rs=mysql_query("select * FROM tbl_category "); while($row=mysql_fetch_array($rs)){ ?> <?php echo $row["cat_ID"]; if($row["cat_ID"]==$rowListing["cat_ID"]) { echo "selected"; echo $row["cat_descp"]; } } } else{ ?> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/106324-convert-a-dropdown-to-text/#findComment-544890 Share on other sites More sharing options...
DeanWhitehouse Posted May 19, 2008 Share Posted May 19, 2008 sorry missed a bit <?php $catOption=$object->allowed_user_category($_SESSION["my_adminid"]); if($catOption==0){ $rs=mysql_query("select * FROM tbl_category "); while($row=mysql_fetch_array($rs)){ echo $row["cat_ID"]; if($row["cat_ID"]==$rowListing["cat_ID"]) { echo "selected"; echo $row["cat_descp"]; } } } else{ ?> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/106324-convert-a-dropdown-to-text/#findComment-544907 Share on other sites More sharing options...
jonw118 Posted May 19, 2008 Author Share Posted May 19, 2008 Thanks for the help... it's working somewhat prints a lot of extra stuff... for example it should say "Residential" but right now it says "1selectedResidential2356789101112" Any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/106324-convert-a-dropdown-to-text/#findComment-544931 Share on other sites More sharing options...
DeanWhitehouse Posted May 19, 2008 Share Posted May 19, 2008 yep., here u go <?php $catOption=$object->allowed_user_category($_SESSION["my_adminid"]); if($catOption==0){ $rs=mysql_query("select * FROM tbl_category "); while($row=mysql_fetch_array($rs)){ if($row["cat_ID"]==$rowListing["cat_ID"]) { echo $row["cat_descp"]; } } } else{ } ?> Quote Link to comment https://forums.phpfreaks.com/topic/106324-convert-a-dropdown-to-text/#findComment-544933 Share on other sites More sharing options...
jonw118 Posted May 19, 2008 Author Share Posted May 19, 2008 Awesome - I appreciate the help so much! I understand now the errors I made... so I can fix for the other ones. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/106324-convert-a-dropdown-to-text/#findComment-545000 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.