[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

01/06/2008 at 12:30PM PST, ID: 23062334
[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.2

how do you populate a dropdown with php?

Asked by RupertA in PHP and Databases, MySQL Server, PHP Scripting Language

Tags: dropdown, populate, query

Hi, I am doing a small one off php page with sql queries to launch some pages from a menu. I was hoping somebody could maybe help me out with a few lines of code for something. To the experienced I would imagine this is fairly easy. Whilst I will tr,  I am novice to php/sql and need a help.

I have this menu page as shown in this diagram.

http://www.ruperta.plus.com/menu.gif

I have done this php page so far where I populate the "select your business" dropdown by a simple sql query. That works. It populates three items, Plumb, Parts, Build. I have put the code at the bottom here and uploaded the php file to some webspace (it won't work properly as I have just put it on webspace, not on my php server).

Anyway, what I would like to happen is as follows. Lets say parts is selected from the 'Select your business' dropdown that I have just mentioned above. I would then like the following sql query to be run for 'parts'

// new query
$query = "SELECT Course FROM Brand_Course WHERE ([Contact Centre] = 'Core')";

and the results to appear in a new dropdown underneath (the core dropdown). The [contact centre] should be what has just been selected from the select your business dropdown i.e 'parts'. The result of the query will produce say three items for the new appearing dropdown, so presumably they need to be put in a new array first? i don't know how to do this either. so if somebody could show me the coding from selecting 'parts' on the first dropdown to the new dropdown appearing with the results of the new query I would be very grateful.

Obviously the idea is that as each item on the first dropdown (select your business) is selected the query is run for each business when it is selected and the dropdown below shows the result of the query.

The php file so far is here and I have included the relevant code snippet to this post.

Thank you!

http://www.ruperta.plus.com/course_selection.php
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:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Course Selection</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
</head>
 
<body>
 
<div style="position:absolute; left:50; top:20">
<img src="training_title.gif">
<div>
 
<div style="position:absolute; left:50; top:133">
<p style="font-family:Verdana; font-size: 10pt">Select your business</p>
</div>
 
 
// this code populates the first drop down, the select your business dropdown
 
<div style="position:absolute; left:180; top:110">
<form method="post" name="Report" id="Report" >
 <select name="Course" id="centre">
            <?php
            //print("including common.php");
            include ('common.php');
            //print("connecting to the db");
            $link = dbConnect();
            //print("connected to: ".$link);
 
            $query = "SELECT DISTINCT business FROM business_tablle";
            $result = mysql_query($query, $link) or die('Query failed: ' . 
 
mysql_error());
 
            print("<Option value =\"Select\">Select</option>");
            while ($row = mysql_fetch_row($result))
            {
                 print("<option value=".$row[0].">".$row[0]."</option>");
            }
 
       ?>
       </select>
 
 
</div>
 
<div style="position:absolute; left:50; top:233">
<p style="font-family:Verdana; font-size: 10pt">Core Courses</p>
</div>
 
</body>
</html>
[+][-]01/06/08 03:36 PM, ID: 20596189

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]01/07/08 09:12 AM, ID: 20600981

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/07/08 01:45 PM, ID: 20603547

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/07/08 03:17 PM, ID: 20604267

View this solution now by starting your 30-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, MySQL Server, PHP Scripting Language
Tags: dropdown, populate, query
Sign Up Now!
Solution Provided By: v2Media
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_2_20070628