$_POST behavior from input=submit vs input-type=button

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default $_POST behavior from input=submit vs input-type=button

    Hello all,

    I have been trying to solve an annoying behavior with PHP (I think).
    Maybe some of you have encountered the same and have some ideas.

    I have an html form and I use an <input type="button"> element with
    the onClick event that calls a javascript funtion. Once the script's
    content has been processed, I execute the form.submit() directive.

    I would like to combine the html form and the PHP script into one, and
    use action="<?php echo($PHP_SELF) ?>".

    When the html form has <input type="button" name="theButton"
    value="thisisthetrigger" onclick="doThis(this.form)">but PHP cannot
    'read' the value of $_POST["theButton"] after form.submit().

    If I substitute the <input type="button"> for <input type="submit">
    then PHP reads the value just fine. Some may argue to just use the
    latter option, but that will cost me a trip back to the server to
    basically do a lot of validation that can be very easily accomplished
    on the client side.

    Any suggestions will be greatly appreciated.

    Victor A. Cuya Guest

  2. Similar Questions and Discussions

    1. input type="button"
      Hi all, I have a flash form that contains an input type="button" with an onclick event that goes to an AS code. I need to be able to access the...
    2. Using Input Type Button to link to Frame Login. NeedHelp!!
      Here is the working code and what I have that doesn't work. Please Help! Working: <td width="120" nowrap>&nbsp;&nbsp;<a...
    3. How to force submit on a specific INPUT TYPE object
      I have a form with two or more INPUT TYPE (image, submit, button) objects, how can I force the ENTER event to act on a specific object and not to...
    4. input=text fires Submit when pressing Enter
      Hello I have some textboxes (input type=Text) in a Form. In some Forms if I Press Enter while I am in the Textbox It causes a Submit. The...
    5. <button> instead of <input type=button>
      Is there an option in dreamweaver MX to set this? I want to use the <button> tag instead of the <input> tag for my buttons because of the extra...
  3. #2

    Default Re: $_POST behavior from input=submit vs input-type=button

    use the input type=submit, move the button event to the form i.e., <form
    onsubmit="doThis(this)"

    Victor A. Cuya wrote:
    > Hello all,
    >
    > I have been trying to solve an annoying behavior with PHP (I think).
    > Maybe some of you have encountered the same and have some ideas.
    >
    > I have an html form and I use an <input type="button"> element with
    > the onClick event that calls a javascript funtion. Once the script's
    > content has been processed, I execute the form.submit() directive.
    >
    > I would like to combine the html form and the PHP script into one, and
    > use action="<?php echo($PHP_SELF) ?>".
    >
    > When the html form has <input type="button" name="theButton"
    > value="thisisthetrigger" onclick="doThis(this.form)">but PHP cannot
    > 'read' the value of $_POST["theButton"] after form.submit().
    >
    > If I substitute the <input type="button"> for <input type="submit">
    > then PHP reads the value just fine. Some may argue to just use the
    > latter option, but that will cost me a trip back to the server to
    > basically do a lot of validation that can be very easily accomplished
    > on the client side.
    >
    > Any suggestions will be greatly appreciated.
    >
    S Austin Guest

  4. #3

    Default Re: $_POST behavior from input=submit vs input-type=button

    "Victor A. Cuya" <vcuya@mindspring.com> wrote in message
    news:5mm1a01pbjccljape5j0j4qsp3bea64pl4@4ax.com...
    > Hello all,
    >
    > I have been trying to solve an annoying behavior with PHP (I think).
    > Maybe some of you have encountered the same and have some ideas.
    >
    > I have an html form and I use an <input type="button"> element with
    > the onClick event that calls a javascript funtion. Once the script's
    > content has been processed, I execute the form.submit() directive.
    >
    > I would like to combine the html form and the PHP script into one, and
    > use action="<?php echo($PHP_SELF) ?>".
    >
    > When the html form has <input type="button" name="theButton"
    > value="thisisthetrigger" onclick="doThis(this.form)">but PHP cannot
    > 'read' the value of $_POST["theButton"] after form.submit().
    >
    > If I substitute the <input type="button"> for <input type="submit">
    > then PHP reads the value just fine. Some may argue to just use the
    > latter option, but that will cost me a trip back to the server to
    > basically do a lot of validation that can be very easily accomplished
    > on the client side.
    >
    > Any suggestions will be greatly appreciated.
    Dear Victor,

    I think you may be stuck. Take a look at Alan Flavell's comments on this
    issue in [url]http://ppewww.ph.gla.ac.uk/~flavell/www/trysub.html[/url]

    George


    sma1king Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139