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
https://forums.phpfreaks.com/topic/106324-convert-a-dropdown-to-text/
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			
}								  
?> 

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

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{

 

}  

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.