Advertisement

03.18.2008 at 12:17PM PDT, ID: 23251413
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.9

dynamic depending drop down

Asked by pertrai1 in PHP and Databases, PHP Scripting Language

Tags:

Hello, I need some help in figuring out how to accomplish this. I do hope I have this set up right to achieve this. I have a table in mysql called tblCategories:

cat_id int(11) NOT NULL auto_increment,
cat_name varchar(30) NOT NULL,
cat_parent int(11) NOT NULL

What I do is enter main categories with a cat_parent value of 0. If it is a subcategory then it takes on the value of the main categories cat_id.

Now in my form I want the drop down subcategory to change to reflect the main category drop down. Hope I am making sense. Do I have this set up to accomplish this?

Thank you for your help and code if possible.
RobStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
<?PHP
$query_cat = "SELECT * FROM tblCategories WHERE cat_parent = 0";
$cat = mysql_query($query_cat, $admin) or die(mysql_error());
$row_cat = mysql_fetch_assoc($cat);
$totalRows_cat = mysql_num_rows($cat);
?>
 
<table>
 <tr>
                      <td>Main Category:</td>
                      <td align="left"><select name="cat_id" id="cat_id">
                        <?php
do {  
?>
                        <option value="<?php echo $row_cat['cat_id']?>"><?php echo $row_cat['cat_name']?></option>
                        <?php
} while ($row_cat = mysql_fetch_assoc($cat));
  $rows = mysql_num_rows($cat);
  if($rows > 0) {
      mysql_data_seek($cat, 0);
	  $row_cat = mysql_fetch_assoc($cat);
  }
?>
                      </select>                      </td>
                    </tr>
                    <tr>
                      <td>Sub Category:</td>
                      <td align="left"><select name="cat_parent" id="cat_parent">
                      </select>                      </td>
                    </tr>
</table>
[+][-]03.18.2008 at 12:36PM PDT, ID: 21154932

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, PHP Scripting Language
Tags: php
Sign Up Now!
Solution Provided By: routinet
Participating Experts: 1
Solution Grade: B
 
 
[+][-]03.18.2008 at 01:35PM PDT, ID: 21155510

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 02:25PM PDT, ID: 21156020

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628