By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 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

Thanks!!

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.         $query="SELECT name,agentid FROM agents";
  3.  
  4. $result = mysql_query ($query);
  5. echo "<select name=agent value=''>Agent Name</option>";
  6.  
  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>";//
  11.  
  12. ?>
Dec 17 '11 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,347
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.