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?
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
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
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!
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
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>