Hello:
I was hoping that someone can help me out.
I have a form which asks for three pieces of information: purchase price, planned closing date and location.
When the person hits the Submit button, they are brought to the next screen which goes through some calculations, etc.
If the results are not favorable, I would like the person to click the Back button and return to this first form and be able to make changes. When the Back button is clicked, I would like for the information which was entered to be displayed. I don't want the person to re-enter everything.
I was able to get the purchase price and location fields to work with no problem. The trouble I have is with the planned closing date. I am unable to figure out how to maintain that information.
I do have sessions turned on in a file called header.html which is included in the script. I tried a number of things and I keep getting syntax errors.
Can someone help me out with remembering the date? Thank you for the help.
This is the script.
<?php
include('header.html');
?>
<form action="calc-best-down-pmt.php" method="post">
<table class="apptable">
<tr><td class="a"><b>Purchase Price:</b></td><td class="b"><input type="text" name="purchaseprice" id="purchaseprice" class="txt" size="45" value="<?php if (isset($_SESSION['purchaseprice'])) echo $_SESSION['purchaseprice']; ?>"></td></tr>
<tr><td class="a"><b>Planned Closing Date:</b></td>
<td class="b">
<?php
$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
'September', 'October', 'November', 'December');
//Make the days and years arrays
$days = range (1,31);
$years = range (2007, 2015);
//Make the months pull-down menu
echo '<select name="month">';
foreach ($months as $key => $value) {
echo "<option value=\"$key\">$value</option>\n";
}
echo '</select>';
//Make the days pull-down menu
echo '<select name="day">';
for ($day = 1; $day <= 31; $day++) {
echo "<option value=\"$day\">$day</option>\n";
}
echo '</select>';
//Make the years pull down menu
echo '<select name="year">';
$year = 2007;
while ($year <= 2015) {
echo "<option value=\"$year\">$year</option>\n";
$year++;
}
echo '</select>';
?>
<tr><td class="a"><b>Property Location:</b></td>
<td class="b"><select name="location" size=1>
<?php
if(isset($_SESSION['location']) && $_SESSION['location'] == 'Georgia')
echo '<option value="Georgia" selected> Georgia ';
else
echo '<option value="Georgia">Georgia ';
?> </select></td></tr>
<tr><td> </td></tr>
</table>
<input type="submit" name="btnSubmit" id="btnSubmit" value="Calculate Best Down Payment Options and Typical Closing Costs" class="btn" >
<input type="hidden" name="submitted" value="TRUE" />
</form>