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

Problem with drop down menu

elen
P: 4
Hello to everyone!
I have a problem and i wish for help.I have a form and i want to contain the values that a specified user had put.I manage to collect correct the values from the database but i have a problem in the drop down menu.I want to shows first the value that the user had choosen.The value is containing in the variable $rf.
I thougth that if i wrote value="<?=$rh;?>" should work but this is wrong!

Expand|Select|Wrap|Line Numbers
  1.  <td align=center><select name="eid_farm3" value="<?=$rh;?>"> 
  2.        <option value="a">A
  3.        <option value="b">B
  4.         <option value="c">C
  5.  </td></select>
  6.  
  7.  
Oct 10 '08 #1
Share this Question
Share on Google+
5 Replies


Dormilich
Expert Mod 5K+
P: 8,639
of course that's wrong.
1st - use <?php / ?>
2nd - output functions: echo, print

today’s recommended link: PHP.net

regards
Oct 10 '08 #2

Markus
Expert 5K+
P: 6,050
of course that's wrong.
1st - use <?php / ?>
2nd - output functions: echo, print

today’s recommended link: PHP.net

regards
Actually, Dormilich, that would work if she hard short tags enabled.

OP: to display the previously selected option, you have to set it to selected="selected"

Expand|Select|Wrap|Line Numbers
  1. <select name="eid_farm3"> 
  2.        <option value="a">A</option>
  3.        <option value="b" selected="selected">B</option>
  4.         <option value="c">C</option>
  5. </select>
Oct 10 '08 #3

Dormilich
Expert Mod 5K+
P: 8,639
Actually, Dormilich, that would work if she hard short tags enabled.
I know, but I think it's better practice to use the php specific tags.
Oct 10 '08 #4

Atli
Expert 5K+
P: 5,058
I know, but I think it's better practice to use the php specific tags.
As do I. Using the short-tags is just lazy.
But they do work if your server is configured that way. (For now)

Dormilich.
Please try not to post links to the German version of the manual.
It's both a lot slower to load for us that are not in Germany, and once it has loaded, we don't understand it.
Oct 10 '08 #5

Dormilich
Expert Mod 5K+
P: 8,639
Dormilich.
Please try not to post links to the German version of the manual.
It's both a lot slower to load for us that are not in Germany, and once it has loaded, we don't understand it.
D***, lately I seem to forget to substitute the "de" in the copied links a lot. It's not that I intend to lead you to the german version (but that's the first one I get and read).

I hope you can forgive me
Oct 10 '08 #6

Post your reply

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