How to do a cancel button in the form and redirect to another page

Discussion in 'HTML' started by Steven, Jul 9, 2003.

  1. Steven

    Steven Guest

    I try to put a submit and cancel button in the form. For submit it will
    execte the script in action. For cancel, would like to cancel the whole
    form and redirect to another page.

    Any help will be appreciated.

    -Steven
     
    Steven, Jul 9, 2003
    #1
    1. Advertising

  2. Steven wrote:

    > I try to put a submit and cancel button in the form. For submit it will
    > execte the script in action. For cancel, would like to cancel the whole
    > form and redirect to another page.


    <input type="submit" name="s" value="Submit">
    <input type="submit" name="s" value="Cancel">

    <?php

    if ($_POST('s') == "Submit") {
    // Do something
    } else if $_POST('s') == "Cancel") {
    header('Location: http://localhost/somepage');
    } else {
    // Throw an error
    }

    ?>

    --
    David Dorward http://david.us-lot.org/
    Redesign in progress: http://stone.thecoreworlds.net/
    Microsoft announces IE is dead (so upgrade):
    http://minutillo.com/steve/weblog/2003/5/30/microsoft-announces-ie-is-dead
     
    David Dorward, Jul 9, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?R1REcml2ZXI=?=
    Replies:
    1
    Views:
    3,845
    Karl Seguin
    Feb 16, 2005
  2. Replies:
    2
    Views:
    14,114
    Guest
    May 6, 2005
  3. =?Utf-8?B?U2VyZ2V5IFp1eWV2?=

    Potentially dangerous Request.Form value for Cancel button Click

    =?Utf-8?B?U2VyZ2V5IFp1eWV2?=, Oct 5, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    513
    Jon Paal
    Oct 5, 2006
  4. Sal
    Replies:
    1
    Views:
    819
  5. Indu
    Replies:
    9
    Views:
    359
Loading...

Share This Page