Results 1 to 2 of 2

Thread: Get Option NAME in form, not TEXT

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Posts
    68

    Get Option NAME in form, not TEXT

    Hey team,

    I'm trying to get the OPTION name from a FORM, and not the actual selected text:

    Code:
    <form method="get" action="test.php">
        <select name="test">
        	<option name="1">Option One</option>
        	<option name="2">Option Two</option>
            <option name="3">Option Three</option>
        </select>
        <input type="submit" name="action" value="Submit">
    </form>
    This works, but is giving me the 'Option One' text, and I'd like to get the number 1 from NAME instead.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Posts
    68

    Re: Get Option NAME in form, not TEXT

    Got it!

    Name should have been value:

    Code:
    <form method="get" action="test.php">
        <select name="test">
        	<option value="1">Option One</option>
        	<option value="2">Option Two</option>
            <option value="3">Option Three</option>
        </select>
        <input type="submit" name="action" value="Submit">
    </form>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width