By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

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

P: 1
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"personal.php"}
else
{include "login.php"} //This has the actual html login form.
[/PHP]

PERSONAL PAGE:
"personal.php"
--> 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='$firstname'";

$result = mysql_query($query);

if ($result)
{
header("location: 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 "enterdataplease.php";
//HERE IS THE PROBLEM, READ ON
}
mysql_close();

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

So, if the user FAILS to enter all the data, we go to "enterdataplease.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 "enterdataplease.php" that returns to "personal.php" 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 "enterdataplease.php", correct?
Feb 20 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.