|
Posted by Juliette on 07/06/06 00:42
David T. Ashley wrote:
> Hi,
>
> For a web page, I want a SUBMIT button that commits the form data and a
> CANCEL button that goes to a different target (i.e. a different script).
>
> I haven't figured out how to do this, because the <FORM ACTION="... tag
> seems to make sure that any two submit controls in a form have to go to the
> same target.
>
> BTW, the CANCEL button does not have to submit any form data.
>
> Thanks, Dave.
>
>
>
You're on the right track.
Submitting a form will *always* submit the form data, be grateful as
that is what we will use.
In your PHP script do something like:
// Was the value of the submit button 'Submit' ?
if( $_POST['submit'] === 'Submit') {
// Process your form
}
// Was the value of the submit button 'Cancel' ?
elseif( $_POST['submit'] === 'Cancel') {
// Redirect to another page or include a different script or any other
way you want to do your cancel action
}
Hope this helps !
Grz, Juliette
Navigation:
[Reply to this message]
|