I'm trying to send a form using the several submit buttons. Each button does something different. One button saves the information to the database, another sends the information via email to people. When I choose to send the information by e-mail I need to ask them to confirm their decision.
This all works however, I send the form elements to another page which in turn tries to determine which button you pressed and then carries out the necessary actions. I haven't yet been able to get everything working together harmoniously yet and my experience says it has something to do with how I'm determining which button on the form was pressed.
My form buttons look like this:
The way I determine which button was pressed is this:
I was also wondering maybe there is a better way to determine which button was pressed. If there is a way to set a variable on the fly in an onClick event or something. If I can do that and send it in the form I could test for it on the other side. Does anybody know how to do this?
This all works however, I send the form elements to another page which in turn tries to determine which button you pressed and then carries out the necessary actions. I haven't yet been able to get everything working together harmoniously yet and my experience says it has something to do with how I'm determining which button on the form was pressed.
My form buttons look like this:
Code:
<input type='submit' name='sendEmail' value='Send E-mail' onClick='confirmit();return false'> <input type='submit' name='saveDraft' value='Save Draft'>
PHP Code:
if($saveDraft!=""){
//perform actions
}
if($sendEmail!=""){
//perform actions
}
Comment