Jump to content

Convert a dropdown to text


jonw118

Recommended Posts

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!

Link to comment
Share on other sites

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			
}								  
?> 

Link to comment
Share on other sites

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			
}								  
?> 

Link to comment
Share on other sites

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{

 

}  

?>

Link to comment
Share on other sites

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.