retreaving a value on method=Post

P

Paul

This is not a pure html question but I can't get help anywhere on
this.

if i have the following in my first page

<input type="submit" name="submit" value="x">
<input type="submit" name="submit" value="y">

I can sy on the next page
If ($_POST['submit'] == x)
{

}


but if I use

<input type="image" name="LogOn" src="images/Submit.gif" alt="Log
On">
I can't do this as <image> has no value="" in this case?

Desmond.
 
J

Jukka K. Korpela

Scripsit Paul:
<input type="submit" name="submit" value="x">
<input type="submit" name="submit" value="y">

Even this is risky if you have a text input field in the form, too. What
happens when the user hits Enter in a text input field? Browsers may act
if a submit button (which? maybe a third one, anonymous) had been used.
Do you know which of the submit buttons the user _wanted_ to use?`

Conclusion: Use radio buttons for selecting an operation, and use just
one submit button. Or maybe two separate forms.
I can sy on the next page
If ($_POST['submit'] == x)

That's PHP, right?
but if I use

<input type="image" name="LogOn" src="images/Submit.gif" alt="Log
On">
I can't do this as <image> has no value="" in this case?

You can't. Conclusion? Don't use image submit buttons. They're poor
usability anyway. They indicate that the designer thinks of his esthetic
preferences more than users' ease of use, including the recognizability
of buttons as buttons.

But if you decide to use an image submit button, and you use PHP, you
need to test for the existence of $POST[LogOn_x]. Ref.:
http://fi2.php.net/manual/en/faq.html.php#faq.html.form-image
 
P

Paul

Scripsit Paul:
<input type="submit" name="submit" value="x">
<input type="submit" name="submit" value="y">

Even this is risky if you have a text input field in the form, too. What
happens when the user hits Enter in a text input field? Browsers may act
if a submit button (which? maybe a third one, anonymous) had been used.
Do you know which of the submit buttons the user _wanted_ to use?`

Conclusion: Use radio buttons for selecting an operation, and use just
one submit button. Or maybe two separate forms.
I can sy on the next page
If ($_POST['submit'] == x)

That's PHP, right?
but if I use
<input type="image" name="LogOn" src="images/Submit.gif" alt="Log
On">
I can't do this as <image> has no value="" in this case?

You can't. Conclusion? Don't use image submit buttons. They're poor
usability anyway. They indicate that the designer thinks of his esthetic
preferences more than users' ease of use, including the recognizability
of buttons as buttons.

But if you decide to use an image submit button, and you use PHP, you
need to test for the existence of $POST[LogOn_x]. Ref.:http://fi2.php.net/manual/en/faq.html.php#faq.html.form-image

Thanks for that. Not the solution I would like but it will work.
Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,104
Messages
2,570,643
Members
47,248
Latest member
Angelita78

Latest Threads

Top