New2PHP. Need validation on form OR good BACK navigation in IE6.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gios11
    New Member
    • Feb 2007
    • 1

    New2PHP. Need validation on form OR good BACK navigation in IE6.

    I have following setup:

    START PAGE:
    "index.php"
    --> User logs in by:
    [PHP]
    if (isset($_POST['login']))
    {
    //--> pull their user data from SQL table.
    //--> Put SQL data to SESSION vars.
    include"persona l.php"}
    else
    {include "login.php" } //This has the actual html login form.
    [/PHP]

    PERSONAL PAGE:
    "personal.p hp"
    --> The session vars pull over successfully and are echoed into <input> boxes (like an auto-fill).
    --> There are other things to fill out, too, you know!

    ** HERE IS THE PROBLEM **
    I use a simple thing like this for insertion into the table:
    [PHP]
    if (isset($_POST['personaldone']))
    {//connect to DB
    $firstname = $_POST['firstname'];
    //etc, etc.
    $query = "INSERT INTO personaltable SET
    firstname='$fir stname'";

    $result = mysql_query($qu ery);

    if ($result)
    {
    header("locatio n: finished.php");
    // I did header instead of include because a refresh
    // would keep inserting into the personaltable
    }
    else
    {
    //HERE IS THE PROBLEM, READ ON
    include "enterdatapleas e.php";
    //HERE IS THE PROBLEM, READ ON
    }
    mysql_close();

    // CLOSING if isset()
    }
    else
    {
    include "personalform.p hp";
    /*this just displays the form the first time-around*/
    }
    [/PHP]

    So, if the user FAILS to enter all the data, we go to "enterdatapleas e.php".
    If I use the browser BACK in Firefox, no problem.
    If I use the browser BACK in IE6 --- ehr!! I get "Warning: Page Has Expired"

    CONCLUSION:
    What is the best away around this?
    I have read that a BACK with $_POST data can be an issue.
    Really, my GOAL is to have 2 things happen:
    1) a link on "enterdatapleas e.php" that returns to "personal.p hp" with the SAME session vars from index.php
    2) BACK in IE6 would retain the SESSION vars....

    MY THOUGHTS:
    It seems to be a problem with how I'm doing sessions, no?
    Or is it an inherent difficulty with POST pages?
    Another option is to validate before the data before it ever hits the INSERTION into SQL and then I wouldn't need the "enterdatapleas e.php", correct?
Working...