By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,871 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,871 IT Pros & Developers. It's quick & easy.

Retain drop down menu value... can't quite get it :( ....

P: 1
I have made a drop down menu from a mysql table, and I want to reatin the value selected in my form. Any help would be great I've tryed reading other forums but can't get it..... I need to use the name, and agentid because I will need it for my linked page


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.         $query="SELECT name,agentid FROM agents";
  4. $result = mysql_query ($query);
  5. echo "<select name=agent value=''>Agent Name</option>";
  7. while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
  8. echo "<option value=$nt[id]>$nt[name]</option>";
  9. }
  10. echo "</select>";//
  12. ?>
Dec 17 '11 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 12,406
When a form is submitted, the value that is selected in a form is passed along.
Dec 18 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.