Vidya_tr Posted April 23, 2009 Share Posted April 23, 2009 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??? Quote Link to comment https://forums.phpfreaks.com/topic/155335-two-actions-for-a-form-is-this-possible/ Share on other sites More sharing options...
jackpf Posted April 23, 2009 Share Posted April 23, 2009 You could use javascript to submit the form. As in, if the submit button is clicked, submit the form to one file, if the save button is clicked, submit it to another. Quote Link to comment https://forums.phpfreaks.com/topic/155335-two-actions-for-a-form-is-this-possible/#findComment-817257 Share on other sites More sharing options...
Psycho Posted April 23, 2009 Share Posted April 23, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155335-two-actions-for-a-form-is-this-possible/#findComment-817266 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.