Reply to Re: Form Submit Button Question

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация