Forum Moderators: coopster
I have the following snippets that are applicable :-
In the session_start() part
$_SESSION['datefished'] = $datefished;
$datefished = $_POST['fldYear'] . '-' . $_POST['fldMonth'] . '-' . $_POST['fldDay'];
and for the hidden field :-
<input name="datefished" type="hidden" id="datefished" value="<?php echo $_SESSION['datefished'];?>" />
The problem seems to be that the date value that appears in the mysql table, is the date from the previous entry and not the current one!
I am seriously confused by this, has anyone got any idea's where I am going wrong?
$_SESSION['datefished'] = $datefished;
$datefished = $_POST['fldYear'] . '-' . $_POST['fldMonth'] . '-' . $_POST['fldD'];
You need to set the value for $datefished first:
$datefished = $_POST['fldYear'] . '-' . $_POST['fldMonth'] . '-' . $_POST['fldD'];
$_SESSION['datefished'] = $datefished;
The value of the session var (and the hidden field) gets updated when you post the form. But then it's too late to get that value in your sql statement.
Just concat the 3 values from the form fields to form the date.
$datefished = $_POST['fldYear'] . '-' . $_POST['fldMonth'] . '-' . $_POST['fldDay'];
HTH, AA