Hide form submit button value

Hello.

Here's my example form:

<form method="get" action="">
<p>
<input type="radio" name="radio_example" id="radio1"
value="radio1_val" />
<label for="radio1">radio button one</label>
</p>
<p>
<input type="radio" name="radio_example" id="radio2"
value="radio2_val" />
<label for="radio2">radio button two</label>
</p>
<p>
<input type="submit" name="submitform" id="submitform"
value="caption" />
</p>
</form>

When submitting this form with the specified GET method you'll get an
URL like this (http://foo.bar/form.php being the form's URL):
http://foo.bar/form.php?radio_example=radio1_val&submitform= caption

Now I want to avoid that the submit button's value is also passed to
the URL, so I would only get this URL when submitting the form:
http://foo.bar/form.php?radio_example=radio1_val

Is this possible?
k3pp0 [ Do, 17 April 2008 09:28 ] [ ID #1944665 ]

Re: Hide form submit button value

k3pp0 schreef:
> Hello.
>
> Here's my example form:
>
> <form method="get" action="">
> <p>
> <input type="radio" name="radio_example" id="radio1"
> value="radio1_val" />
> <label for="radio1">radio button one</label>
> </p>
> <p>
> <input type="radio" name="radio_example" id="radio2"
> value="radio2_val" />
> <label for="radio2">radio button two</label>
> </p>
> <p>
> <input type="submit" name="submitform" id="submitform"
> value="caption" />
> </p>
> </form>
>
> When submitting this form with the specified GET method you'll get an
> URL like this (http://foo.bar/form.php being the form's URL):
> http://foo.bar/form.php?radio_example=radio1_val&submitform= caption
>
> Now I want to avoid that the submit button's value is also passed to
> the URL, so I would only get this URL when submitting the form:
> http://foo.bar/form.php?radio_example=radio1_val
>
> Is this possible?

Hi,

Leave out the name of the submitbutton.
I think only named formelements are actually send.

I must add I cannot see any reason to leave that part out, but well...
that is just me.

Regards,
Erwin Moller
Erwin Moller [ Do, 17 April 2008 10:43 ] [ ID #1944667 ]

Re: Hide form submit button value

Erwin Moller a écrit :
> I think only named formelements are actually send.
I confirm, plus I add that it's not PHP related at all ;)

Regards,
--
Guillaume
Guillaume [ Do, 17 April 2008 11:48 ] [ ID #1944669 ]

Re: Hide form submit button value

On 17 Apr, 10:48, Guillaume <ggra... [at] NOSPAM.gmail.com.INVALID> wrote:
> Erwin Moller a =E9crit :> I think only named formelements are actually sen=
d.
>
> I confirm, plus I add that it's not PHP related at all ;)
>
> Regards,
> --
> Guillaume

Hey Guillaume, that's Jerry's job!
Captain Paralytic [ Do, 17 April 2008 12:06 ] [ ID #1944670 ]

Re: Hide form submit button value

..oO(Erwin Moller)

>> When submitting this form with the specified GET method you'll get an
>> URL like this (http://foo.bar/form.php being the form's URL):
>> http://foo.bar/form.php?radio_example=radio1_val&submitform= caption
>>
>> Now I want to avoid that the submit button's value is also passed to
>> the URL, so I would only get this URL when submitting the form:
>> http://foo.bar/form.php?radio_example=radio1_val
>>
>> Is this possible?
>
>Hi,
>
>Leave out the name of the submitbutton.
>I think only named formelements are actually send.
>
>I must add I cannot see any reason to leave that part out, but well...

It keeps the URL shorter and is not really necessary for the form
processing.

Micha
Michael Fesser [ Do, 17 April 2008 21:22 ] [ ID #1944710 ]

Re: Hide form submit button value

k3pp0 wrote:

> Now I want to avoid that the submit button's value is also passed to
> the URL, so I would only get this URL when submitting the form:
> http://foo.bar/form.php?radio_example=radio1_val
>
> Is this possible?

Just drop this control before submitting:

<HTML>
<BODY>
<FORM onSubmit="var d=this.toDrop;d.parentNode.removeChild(d);">
<INPUT NAME="toLeave">
<INPUT NAME="toDrop" TYPE="SUBMIT">
</FORM>
</BODY>
</HTML>
Alexey Kulentsov [ Fr, 18 April 2008 10:16 ] [ ID #1945383 ]
PHP » comp.lang.php » Hide form submit button value

Vorheriges Thema: Admin Content in php5 + xml (no mysql)
Nächstes Thema: CHMOD testing?