Advertisement

05.17.2008 at 10:21AM PDT, ID: 23410906
[x]
Attachment Details

How do I get my dropdown box to display the current db data in php/mysql

[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
Tags:

PHP, HTML, MySQL

I have a completed an input page in php, now i am working on the edit page
the edit page of course will pull in all the current values from the db
i open the edit page I want the two  dropdown boxes to show the current selected values from the db

how do i do that?

view the page here: http://www.mywebgenius.net/purestaff/contr_edit_job.php

and the code for the dropbox is attached
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:
55:
56:
$qryClients ="Select id, clientName from clients where client_active='Yes'";
$resultClients = mysql_query($qryClients, $connection) or die("query error");
 
$qryRep ="Select id, lname from staff where current ='y'";
$resultRep = mysql_query($qryRep, $connection) or die("query error");
 
echo "<FORM method = 'post' action=".basename($_SERVER['PHP_SELF'])." NAME=frmAddNewJob>";
echo "<p>".$row['fname']."  ".$row['lname']."</p>";
 
echo "<table border=1 width=100%>
  <tr>
    <th width=20%>Company Name</th>
    <th width=20%>Rep</th>
    <th width=20%>Start date</th>
    <th width=20%>&nbsp;End date</th>
    <th width=20%>Title</th>
  </tr>
  <tr>
    <td width=20%>";
    if(mysql_num_rows($resultClients) > 0)
		{
		  echo("<select name=\"clientID\">");
		  while($rowClients = mysql_fetch_object($resultClients)){
		    echo("<option value=\"$rowClients->id\">$rowClients->clientName</option>");
		  }
		  echo("</select>");
		}
		else{
		  echo("<i>No values found.</i>");
}
echo "</td>
    <td width=20%>";
    
    if(mysql_num_rows($resultRep) > 0)
		{
		  echo("<select name=\"RepID\">");
		  while($rowRep = mysql_fetch_object($resultRep)){
		    echo("<option value=\"$rowRep->id\">$rowRep->lname</option>");
		  }
		  echo("</select>");
		}
		else{
		  echo("<i>No values found.</i>");
		}
		/*echo "</td>
    <td width=20%><input type=text name=txt_start_date size=25>";
echo "<a href=javascript:show_calendar('document.frmAddNewJob.txt_start_date');><img src='cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the timestamp'></a></td>";*/
 
echo "</td>
    <td width=20%><input type=text id=DPC_date1 name=txt_start_date size=14  value=$rowJobs[start_date]></td>";
 
    echo "<td width=20%><input type=text id=DPC_date2 name=txt_end_date size=20  value=$rowJobs[end_date]>";
    //echo "<a href=javascript:show_calendar('document.frmAddNewJob.txt_end_date');><img src='cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the timestamp'></a>";
 
    
    echo "</td>
 
 
 
Expert Comment by routinet:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Author Comment by justmelat:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Expert Comment by routinet:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Accepted Solution by justmelat:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
20081119-EE-VQP-45 / EE_QW_2_20070628