SitePoint Sponsor

User Tag List

Results 1 to 25 of 37

Threaded View

  1. #26
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    In basic structure, here's a way to do it.

    PHP Code:
    <?php
    // Decide whether we show the form, or try to process the form details
    $showform true;

    // Set a flag for showing timesheet done message, and doing the redirect
    $timesheet false;

    if (isset(
    $_POST['submit'])) {
        
    // Form has been submitted - try to process
        // All your connection, form variables and SQL code goes here
        // You should already have the necessary code from previous posts

        // Assuming all went OK - allow the page to redirect
        
    $timesheet true;
        
    $showform false;
    }
    ?>
    <html>
    <head>
    Put whatever other header tags are needed here

    <?php
    if ($timesheet === true) {
        
    // Set the redirect metatag
        
    echo '<meta http-equiv="refresh" content="5;url=http://website/page.php">';
    }
    ?>
    </head>
    <body>

    <?php
    if ($showform === true) {
    ?>
    <form action="" method="post">
    <!-- Put the form here -->
    </form>
    <?php
    }
    ?>

    <?php
    if ($timesheet=== true) {
        echo 
    '<p>Your timesheet has been saved.</p>';
    }
    ?>

    </body>
    </html>
    Last edited by siteguru; Aug 8, 2007 at 08:50.
    Ian Anderson
    www.siteguru.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •