OK. I am in session hell. Hope someone can help me.
update.php is a form
submits to dbupdate.php
validate - if there is an error write posted variables to a session to populate the form
back to update.php - the sessions populate the fields but when I make changes and submit again without errors, it will not see the changes and does not update the database ... it retains the session values instead.
Also, if I go to update another item... it still shows some of the session data from the last one.
I have tried ot loop through and unset session values with no success. I have treid putting $_REQUEST before variables and am running into issues.
Here is the top of update.php (I have to retain the login session var)
$login = $_SESSION['login'];
if(isset($_REQUEST['errmsg'])){
$errmsg = $_REQUEST['errmsg'];
} else {
$errmsg = "";
}
if(isset($_REQUEST['submit'])){
$submit = $_REQUEST['submit'];
} else {
$submit = "";
}
if(isset($_REQUEST['process'])){
$process = $_REQUEST['process'];
} else {
$process = "";
}
// if this is an update page and not a new listing
// supply the action for updating a vessel
// if there is no error then they just got here and we need to load the database data
// else they have entered data and got an error... the dbupdate pages loads the variables back to this page.
if ($process == "update"){
$actionURL = "dbupdate.php";
if($errmsg == ""){
include("loaddata.php"); // loads from db
}
else if($errmsg !=""){
include("header_session.php"); // load session data
}
} else {
$actionURL = "dbinsert.php";
if($errmsg == ""){
include("list_init.php");
}
}
And here is a portion of the dbupdate page:
/*#########
* Start of the main function.
########### */
session_start();
include("db_connect.php");
//Updates - have to update pictures first since th e sessions will not save them
include_once("update-pictures.php");
$errmsg = "";
include('validate.php'); // all have $_request
if($errmsg != ""){
$header_variables = "";
include('header_variables.php');
//Redirect the error message back to the add boat page.
header("location:update.php?process=update&errmsg=$errmsg");
exit;
}
I can post more but I dont know where to start.