Jump to content

two actions for a form -Is this possible?


Vidya_tr

Recommended Posts

I have a form which creates a question  and enters choices for the question(to upload a quiz)

There are three blank spaces for choice entry.

there is a button in the form which on click should create one more blank space for an extra choice

I use the $_SERVER['PHP_SELF"] as the form action when the button is clicked ,and the space for extra choice is created on the page.

After the choices are entered,I have a SAVE button whose action is to post the entries to another page.

 

How can I write the form action to do both functions???

Link to comment
https://forums.phpfreaks.com/topic/155335-two-actions-for-a-form-is-this-possible/
Share on other sites

JavaScript is not necessary, just have two submit buttons that pass different values to the processing page. Then include logic to perform the appropriate action based upon the button used to submit the form. Of course, you will need to determine a "default" action to take if the user submits via the enter key.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.