Problem with drop down menu

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elen
    New Member
    • Sep 2008
    • 4

    Problem with drop down menu

    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!

    Code:
     <td align=center><select name="eid_farm3" value="<?=$rh;?>"> 
       	<option value="a">A
       	<option value="b">B
            <option value="c">C
     </td></select>
    Last edited by pbmods; Oct 10 '08, 10:28 AM. Reason: Fixed CODE tags.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    of course that's wrong.
    1st - use <?php / ?>
    2nd - output functions: echo, print

    today’s recommended link: PHP.net

    regards
    Last edited by Atli; Oct 10 '08, 06:57 PM. Reason: Replaced German link with it's English counterpart.

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Originally posted by Dormilich
      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="selec ted"

      Code:
      <select name="eid_farm3"> 
      	   <option value="a">A</option>
      	   <option value="b" selected="selected">B</option>
      		<option value="c">C</option>
      </select>

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Originally posted by Markus
        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.

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          Originally posted by Dormilich
          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.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            Originally posted by Atli
            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

            Comment

            Working...