PHP _GET problem on chained menu

220 pts.
Tags:
PHP
PHP menu
Hello I've created a continuous menu, consisting of 3 divs : Category, Sub-category, Item What I want is when I click the category I want, the sub categories to appear. Then, when clicking on the sub-category I want, the corresponding items to appear. I created this, using PHP _GET and it works fine, except when I click on the sub-category I want and the items appear, the sub-categories disappear. Any ideas on what can I do to fix this? Thank you

Answer Wiki

Thanks. We'll let you know when a new response is added.

Anyone?? :(

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    Anyone wanting to help you will probably need to look at your code.
    69,175 pointsBadges:
    report
  • pforos
    OK. So, here's the script I've used on both menus: <ul> <?php $flag = 0; if (isset($_GET['c_id'])) { $c_id = $_GET['c_id']; include("plus/db_con.php"); $query = mysql_query ("SELECT c_id, c_name FROM categories WHERE c_depend=".$c_id); while ($row = mysql_fetch_array($query)) { echo '<li><a href="select-interests.php?int_id='.$row['c_id'].'">'.$row['c_name'].'</a></li>'; } mysql_close(); } ?> </ul>And the second, where the sub-category is chosen and the coresponding items appear: <ul> <?php if (isset($_GET['int_id'])) { include("plus/db_con.php"); $query = mysql_query ("SELECT int_name FROM interests WHERE c_id=".$_GET['int_id']); while ($row = mysql_fetch_array($query)) { echo '<li><input type="checkbox"><label for="interestName">'.$row['int_name'].'</label></li>'; } mysql_close(); } ?> </ul>It functions as it is supposed to. The problem is (because of the _GET) when I choose a sub-category, all sub-categories disappear.So any ideas what would make it work?
    220 pointsBadges:
    report
  • pforos
    Is it possible to use the onclick parameter of javascript to make the items appear and still have the sub-categories?
    220 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following