I'm guessing this is pretty simple but I haven't been able to find the answer anywhere.
I have a form that only logged in users have access to that collects data about events. If the user submits the form and any data is missing or in error they get a message that there were errors or missing data and to please go back and resubmit the form. The problem is, when they click the back button they get an entirely blank form, all the data they entered is cleared.
How can the data in the form be retained in instances of error or missing data?
Here is the form.
<?php
include "writers_include_fns.php";
session_register("auth_user");
include_once("headfooter_fns.php");
if (!check_auth_user())
{
do_xhtml_header("You Are Not Logged In");
display_login_form();
} else {
session_register ('Event_Name');
session_register ('Date');
do_xhtml_header("EVENT REGISTRATION"); ?>
<div class="content">
<div class="item">
<?php display_user_menu(); ?>
</div>
<div class='item'>
<h3>EVENT SCHEDULE</h3>
<div class="b">
<h2 id="pagebreak">ALL FIELDS REQUIRED!</h2>
<label>Use to update or change submitted events also. For minor changes please just email the webmaster. <u>DO NOT USE QUOTATION MARKS.</u> <u>COMPETELY</u> FILLED OUT. <u>USE ZEROS FOR BLANKS.</u> Print a copy for your records and click the submit button.
</label>
<form name="eventform" method="POST" action="insert_sched.php">
<ul>
<li><label>Event Name: </label>
<input type='text' name='Event_Name' size="45" /></p>
</li><li><label>Date (month/date/year". If 2 day or more use "month/date-date/year".): </label>
<input type='text' name='Date' size='11'>
</li><li><label>Start Day(Fri,Sat,Sun. If 2 Day or more Format Sat-Sun or Sat-Mon): </label>
<input type='text' name='Day' size='4'>
</li><li><label>Time(Format 10:00 AM, <u>Actual Time of Tee Off</u>): </label>
<input type='text' name='Time' size='9'></p>
</li><li><label>Host Club: </label>
<input type='text' name='Host_Club' size='45'>
</li><li><label>Course (Course - Town <u>no commas please</u>): </label>
<input type='text' name='Course' size='30'>
</li><li><label>Event State ("PA"<u>All Caps</u>): </label>
<input type='text' name='State' size='3'></p>
</li><li><label>Director Name: </label>
<input type='text' name='Director_Name' size='30'>
</li><li><label>Phone(111-111-1111): </label>
<input type='text' name='Director_Number' size='13'>
</li><li><label>Email(johndoe@domain.com): </label>
<input type='text' name='Director_Email' size='50'>
</li><li>
<label>Event Details : (Max 300 characters)</label>
<textarea name="Event_Details" rows="5" cols="60"></textarea>
</li><li><label>Online Event Flyer or Host Website Path, If none, write "None" please.: </label>
<input type='text' name='Host_Web_Site' size='60'>
</li><li><label>Event CLUB Type :</label>
<ul>
<li><input type='radio' name='CLUB_Type' size='2' value='A'><label>CLUB A Series (CLUB Board Approval Necessary)</label>
</li><li><input type='radio' name='CLUB_Type' size='2' value='B'><label>CLUB B Series (CLUB Board Approval Necessary)</label>
</li><li><input type='radio' name='CLUB_Type' size='2' value='L'><label>CLUB Local Schedule (Unlimited "30/50" Local Option)</label>
</li><li><input type='radio' name='CLUB_Type' size='2' value='N'><label>CLUB Local Schedule (Unlimited "30/50" Local Option)</label>
</li>
</ul>
</li><li><label>Event PDGA Type:</label>
<ul>
<li><input type='radio' name='Org_Type' size='2' value='M'><label>PDGA Major</label>
</li><li><input type='radio' name='Org_Type' size='2' value='NT'><label>PDGA National Tour</label>
</li><li><input type='radio' name='Org_Type' size='2' value='A'><label>PDGA A Tier</label>
</li><li><input type='radio' name='Org_Type' size='2' value='B'><label>PDGA B Tier</label>
</li><li><input type='radio' name='Org_Type' size='2' value='C'><label>PDGA C Tier</label>
</li><li><input type='radio' name='Org_Type' size='2' value='S'><label>PDGA D Tier</label>
</li><li><input type='radio' name='Org_Type' size='2' value='X'><label>PDGA Experimental Tier (Non-Standards Format or Rules)</label>
</li>
</ul>
</li><li><label>Event Rules Type:</label>
<ul>
<li><input type='radio' name='Org_Type' size='2' value='N'><label>PDGA Rules</label>
</li><li><input type='radio' name='Org_Type' size='2' value='NN'><label>Non-Standard Rules</label>
</li>
</ul>
<p>Submission of this form represents the Tournament Directors Signature, you are solely responsible for the content and accuracy of its information.
<input type='submit' name='Submit' value='Register'>
</p>
</ul>
</form>
<h3>On behalf of the Regional Club Board of Directors, Volunteers, Members, and Fellow CLUB Directors we would like to
thank you for your decision to be an important part of our CLUB Schedule.</h3>
</div>
</div>
</div>
</div>
<?php } ?>
<?php do_xhtml_footer("");?>
Here is the insert_sched.php file
<?php
// this creates our Official CLUB Schedule Page '>
session_register ('Event_Name');
session_register ('Date');
include_once("headfooter_fns.php");
do_xhtml_header("Event Added To Waitlist");
?>
<!--Start Main Content-->
<div class="content">
<div class='item'>
<h2>CLUB SCHEDULE REGISTRATION</h2>
<div class="subitem">
<ul><li><label>
<?php
if (!$Date || !$Day || !$Time || !$Event_Name || !$CLUB_Type || !$ORG_Type || !$Course || !$State || !$Director_Name || !$Director_Number || !$Director_Email || !$Host_Club || !$Host_Web_Site)
{
echo "You have not entered all the required details.<br>"
."Please go back and try again.";
exit;
}
$SID = addslashes($SID);
$Date = addslashes($Date);
$Day = addslashes($Day);
$Time = addslashes($Time);
$Event_Name = addslashes($Event_Name);
$CLUB_Type = addslashes($CLUB_Type);
$Org_Type = addslashes($ORG_Type);
$Course = addslashes($Course);
$State = addslashes($State);
$Director_Name = addslashes($Director_Name);
$Director_Number = addslashes($Director_Number);
$Director_Email = addslashes($Director_Email);
$Event_Details = addslashes($Event_Details);
$Host_Club = addslashes($Host_Club);
$Host_Web_Site = addslashes($Host_Web_Site);
$eDate = addslashes($eDate);
@ $db = mysql_pconnect("server.com", "username", "password");
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("maindatabase");
$query = "insert into schedule values
('".$SID."','".$Date."', '".$Day."', '".$Time."', '".$Event_Name."', '".$CLUB_Type."', '".$Org_Type."', '".$Course."', '".$State."', '".$Director_Name."', '".$Director_Number."', '".$Director_Email."', '".$Event_Details."', '".$Host_Club."', '".$Host_Web_Site."', '".$eDate."')";
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows(). "Record has been added. Your event has been inserted into database.";
?>
</label></li></ul>
</div></div></div>
<?php
do_xhtml_footer("");
?>
Again, I'm hoping this is a simple fix, thanks for any help.