one form two buttons again :-)

S

sindre

Hi,

In quite a long time I have tought that this question have only one answer.
It wont work. But then I tried it and it did work.
So the question is do it always work? Is there a reason to not do this?
Why I ask is if this work I can set php to figure out what to do with the
input based on the submit name/value!

What I tried is
<input type="submit" name="save" value="Save">
<input type="submit" name="save2" value="Save2">

Both sends the form input.

Sindre
 
S

SpaceGirl

sindre said:
Hi,

In quite a long time I have tought that this question have only one answer.
It wont work. But then I tried it and it did work.
So the question is do it always work? Is there a reason to not do this?
Why I ask is if this work I can set php to figure out what to do with the
input based on the submit name/value!

What I tried is
<input type="submit" name="save" value="Save">
<input type="submit" name="save2" value="Save2">

Both sends the form input.

Sindre

Rather than have the 2nd button submit your form, have it run a
javascript that collects the values of the form elements and posts them
for you to the alternate form processor. That way you can have as many
submit buttons as you care for.


--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
J

Jukka K. Korpela

sindre said:
In quite a long time I have tought that this question have only one
answer.

It's best to start from the question. What was it, really?
It wont work. But then I tried it and it did work.

Sounds like a zen thing.
So the question is do it always work?

Maybe, maybe not.
Is there a reason to not do this?

Depends on "this" (and the current definition of "reason").
What I tried is
<input type="submit" name="save" value="Save">
<input type="submit" name="save2" value="Save2">

Both sends the form input.

Ummm... not surprisingly, right?

If the question is whether you can reliably recognize which button was
used, then it _is_ a frequently asked question. Do you want us to carry
out the Nth iteration of the discussion, or would you like to peek at the
FAQs? (Remember that on Usenet, the Nth iteration is usually an
improvement over the (N+1)th iteration.)

The short answer is that such a scenario, with adequate server-side code,
works reliably in the special case where the form has no text input
fields.
 
S

sindre

If the question is whether you can reliably recognize which button was
used, then it _is_ a frequently asked question. Do you want us to carry
out the Nth iteration of the discussion, or would you like to peek at the
FAQs? (Remember that on Usenet, the Nth iteration is usually an
improvement over the (N+1)th iteration.)

The short answer is that such a scenario, with adequate server-side code,
works reliably in the special case where the form has no text input
fields.

It's fine. Thank you.
I could take a look at the FAQ!
Sindre
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,084
Latest member
HansGeorgi

Latest Threads

Top