Jump to content

Category, subcategory problem


Recommended Posts

Hi,

 

I'm trying to make a classified ad. I made a table for the main category and for the sub category. When the user will select from the main category, I'd like to display just those in the subcategory. I really tried but I can't solve it yet.

 

Here's the code.

 

<form name="form1" method="post" action="">
 <select name="select" size="10">
   <?php
do {  
?>
   <option value="<?php echo $row_Recordset1['mid']?>"><?php echo $row_Recordset1['mdesc']?></option>
   <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
 $rows = mysql_num_rows($Recordset1);
 if($rows > 0) {
     mysql_data_seek($Recordset1, 0);
  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
 }
?>
 </select>
 <select name="select2" size="10">
   <?php
do {  
?>
   <option value="<?php echo $row_Recordset2['sid']?>"><?php echo $row_Recordset2['sdesc']?></option>
   <?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
 $rows = mysql_num_rows($Recordset2);
 if($rows > 0) {
     mysql_data_seek($Recordset2, 0);
  $row_Recordset2 = mysql_fetch_assoc($Recordset2);
 }
?>
 </select>
</form>

 

 

Is there a better way of doing this? Any site you recommend?

 

Any info would be greatly appreciated.

 

--Browneyes

 

 

Link to comment
Share on other sites

Do you mean that when you select from the main catagory, only the sub categories of the selected main item are displayed. If this is what you mean then you need a multiple cascading menu that dynamically displays the sub-menus when the main value is selected.

There is a very good MX extension available from Phakt that simplifys this menu type creation called MX Widgets

Look here MX Widgets

 

Hope this helps :)

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.