SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've got a case switch. And some of the case's have got forms in them, that I want to send to other case's (in the same switch) to get dealt with.

    I've tried putting the case name in the submit button's name attribute and it doesn't work:

    Code:
    <input type="submit" name="login" value="Log In" />
    with login being the name of one of the case's. I can put the case in the action attribute of the form tag and it will work, but then it takes no notice of what is in the name attribute of the submit button. I also tried putting it like this:

    Code:
    <input type="submit" name="action=login" value="Log In" />
    But this doesn't work either (action being the name of the switch).

    I would prefer not to have to put the action=login in the form action attribute because I don't want visitors seeing in the address bar: rave.php?action=register2 for example. Is there any other way in which I can get it to work by putting it in the name attribute of the submit button?

    Of course I could do it with if, elseif's and else, but I don't like so many { and }'s

    Cheers

  2. #2
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could use:
    Code:
    <input type="submit" name="action" value="login" value="Log In" />
    And then do an on case thing where value = "Log In".

    Or you could POST the form and have the action as a hidden variable:
    Code:
    <input type="hidden" name="action" value="login" />

  3. #3
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Skunk, I used the hidden field method, and it has solved all my problems!


Bookmarks

Posting Permissions

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