OK, here's a very stripped down version: I didn't include every variable being used, but otherwise it's complete.
<?php # Script A1.0 Application Form 1 Processor //very first line of code
session_start(); // do this first
$page_title =' Name of page here';
include ('application_header.html'); //sets doctype, identifies .css, sets opening tags
include ('functions.php');
// set unvalidated variables
$aptno = $_POST['aptno']; //plus a few others
// concatenate some variables into strings
$cellphone = make_phone($c_areacode, $c_prefix, $c_phoneno, '');
$workphone = make_phone($w_areacode, $w_prefix, $w_phoneno, $w_ext);
// test to see if form has been submitted
if (isset($_POST['submitted'])) { // begin data validation
// Last Name
$last_name = $_POST['last_name'];
if (check_name($last_name) == TRUE) { // Last name
$flag_last_name = TRUE; //
$flags = TRUE;
} else { //have last name
$flag_last_name = NULL;
} // last name OK
//Validate first name
$first_name = $_POST['first_name'];
if (check_name($first_name) == TRUE) { //First name
$flag_first_name = TRUE;
$flags = TRUE;
} else { //first name entered
$flag_first_name = NULL;
} //first name is OK
//plus a bunch more
//end of data validation}
// If there are no errors, fill the SESSION array and redirect to next page
if (($flags == NULL) && ($flags2 == NULL)) { //no flags, continue
// Fill the data array
$_SESSION['last_name'] = $last_name;
$_SESSION['first_name'] = $first_name;
//etc. for the rest of the input data
// Build the URL of the next page and redirect
$url = dirname($_SERVER['PHP_SELF']);
if ((substr($url, -1) == '/') or (substr($url, -1) =='\\')) {
$url = substr($url, 0, -1);
$_SESSION['calling1'] = $url; //pass along the URL of this page in case want to come back to it.
}
$url = $url.'/application_form2.php'; //the next page in line
// header("location: $url"); //go to it, currently commented out until next form available
exit(); }
} else { //display the form
?>
<form action="application_form1.php" method="post">
<div id="header">
Form name.<br>
Application- Section 1<br>
</div>
<div id="form_area">
<p>1. Applicant Information: Please enter your information below. When you have finished, press the "Next" button at the bottom of the form to continue.</p>
<p>
<?php // if there are errors, display appropriate error msg or msgs
if ($flags == TRUE) {
echo '<p><font color="red">Please complete all required fields, indicated by</font> *<input type="text" name="err" size="8" class="textb" /></p>';
}
if ($flags2 == TRUE) {
echo '<p>Error in optional field, as indicated by <input type="text" name="err2"
size ="8" class="textc" /></p>';
} ?>
<hr>
<p>Last Name: *<input type="text" name="last_name" size="20" maxlength="40" tabindex="1" class ="<?php error_field1($flag_last_name) ?>" value="<?php echo make_sticky ($last_name); ?>" />
<!-- The first snippet of php calls a function to see if the error flag for that variable is set, i.e., it didn't validate or is an empty field for a required variable. If ithere is a flag, it changes the background color as determined by the application style sheet. The second snippet makes the field sticky by checking to see if it's not empty, then echoing that back. These seem to work OK. -->
First Name: *<input type="text" name="first_name" size="20" maxlength="30" class="<?php error_field1($flag_first_name) ?>" value="<?php echo make_sticky ($first_name);?>" />
<!-- This continues for the rest of the inputs -- there are a whole bunch more, but they're basically repeats of these - all of this seems to work OK -->
</div> <!-- end of form div -->
<div id="buttons">
<input type="submit" name="continue" value="Next >>" />
<input type ="reset" name="reset" value="Reset" />
<input type="hidden" name="submitted" value="TRUE" />
</div> <!-- end of buttons -->
</form>
<?php
} // to close out main conditional
?>
</body>
</html>
Other than leaving out a whole bunch of input variables, that's it.