I've got an insurance script that runs a set of price quotes. Some things such as birth date, gender, and plan name selected get carried over to the application on submit when they click the button to apply for the plan. What I'm having trouble with is getting the actual price to carry over to the application.
Here are the two php files that handle the quote print out and application:
Quote_Step_2
<?php
foreach ($_POST as $key => $value) {
$$key = $value;
}
include("connect.php");
$today = date('Ymd');
$dob_applicant = $month_applicant . " " . $day_applicant . ", " . $year_applicant;
// APPLICANT AND DEPENDENT AGES
$dob_a = $year_applicant . $month_applicant . $day_applicant;
$age_applicant = (int)(($today - $dob_a)/10000);
$no_dependents = 0;
If ($age_applicant <= 18) {
$age_applicant = 18;
}
If (!empty($year_spouse)) {
$dob_s = $year_spouse . $month_spouse . $day_spouse;
$age_spouse = (int)(($today - $dob_s)/10000);
$no_dependents++;
$dob_spouse = $month_spouse . " " . $day_spouse . ", " . $year_spouse;
If ($age_spouse <= 18) {
$age_spouse = 18;
}
} Else {
$age_spouse = "";
$dob_spouse = "";
}
If (!empty($year_child1)) {
$dob_c1 = $year_child1 . $month_child1 . $day_child1;
$age_child1 = (int)(($today - $dob_c1)/10000);
$no_dependents++;
$dob_child1 = $month_child1 . " " . $day_child1 . ", " . $year_child1;
If ($age_child1 <= 18) {
$age_child1 = 18;
}
} Else {
$age_child1 = "";
$dob_child1 = "";
}
If (!empty($year_child2)) {
$dob_c2 = $year_child2 . $month_child2 . $day_child2;
$age_child2 = (int)(($today - $dob_c2)/10000);
$no_dependents++;
$dob_child2 = $month_child2 . " " . $day_child2 . ", " . $year_child2;
If ($age_child2 <= 18) {
$age_child2 = 18;
}
} Else {
$age_child2 = "";
$dob_child2 = "";
}
If (!empty($year_child3)) {
$dob_c3 = $year_child3 . $month_child3 . $day_child3;
$age_child3 = (int)(($today - $dob_c3)/10000);
$no_dependents++;
$dob_child3 = $month_child3 . " " . $day_child3 . ", " . $year_child3;
If ($age_child3 <= 18) {
$age_child3 = 18;
}
} Else {
$age_child3 = "";
$dob_child3 = "";
}
If (!empty($year_child4)) {
$dob_c4 = $year_child4 . $month_child4 . $day_child4;
$age_child4 = (int)(($today - $dob_c4)/10000);
$no_dependents++;
$dob_child4 = $month_child4 . " " . $day_child4 . ", " . $year_child4;
If ($age_child4 <= 18) {
$age_child4 = 18;
}
} Else {
$age_child4 = "";
$dob_child4 = "";
}
If (!empty($year_child5)) {
$dob_c5 = $year_child5 . $month_child5 . $day_child5;
$age_child5 = (int)(($today - $dob_c5)/10000);
$no_dependents++;
$dob_child5 = $month_child5 . " " . $day_child5 . ", " . $year_child5;
If ($age_child5 <= 18) {
$age_child5 = 18;
}
} Else {
$age_child5 = "";
$dob_child5 = "";
}
// GET MAXIMUM AGE FROM DATABASE
$getmax = "SELECT age FROM comp500 ORDER BY age DESC LIMIT 1";
$max_result = mysql_query($getmax);
while ($max = mysql_fetch_array($max_result)) {
$max_age = $max["age"];
}
$max_age = number_format($max_age, 0);
// CHECK MAXIMUM AGE
If ($age_applicant > $max_age || $age_spouse > $max_age || $age_child1 > $max_age || $age_child2 > $max_age || $age_child3 > $max_age || $age_child4 > $max_age || $age_child5) {
$error = "yes";
} Else {
$error = "no";
}
// PROCEED WITH RETRIEVING QUOTES IF NO ERROR
If ($error == "no") {
include ("calc_applicant.php");
If (!empty($age_spouse)) {
include("calc_spouse.php");
}
If (!empty($age_child1)) {
include("calc_child1.php");
}
If (!empty($age_child2)) {
include("calc_child2.php");
}
If (!empty($age_child3)) {
include("calc_child3.php");
}
If (!empty($age_child4)) {
include("calc_child4.php");
}
If (!empty($age_child5)) {
include("calc_child5.php");
}
$price_comp500 = $price_comp500 + $price2_comp500 + $price3_comp500 + $price4_comp500 + $price5_comp500 + $price6_comp500 + $price7_comp500;
$price_comp500 = number_format($price_comp500, 2);
$price_comp1000 = $price_comp1000 + $price2_comp1000 + $price3_comp1000 + $price4_comp1000 + $price5_comp1000 + $price6_comp1000 + $price7_comp1000;
$price_comp1000 = number_format($price_comp1000, 2);
$price_comp1500 = $price_comp1500 + $price2_comp1500 + $price3_comp1500 + $price4_comp1500 + $price5_comp1500 + $price6_comp1500 + $price7_comp1500;
$price_comp1500 = number_format($price_comp1500, 2);
$price_comp3000 = $price_comp3000 + $price2_comp3000 + $price3_comp3000 + $price4_comp3000 + $price5_comp3000 + $price6_comp3000 + $price7_comp3000;
$price_comp3000 = number_format($price_comp3000, 2);
$price_comp4500 = $price_comp4500 + $price2_comp4500 + $price3_comp4500 + $price4_comp4500 + $price5_comp4500 + $price6_comp4500 + $price7_comp4500;
$price_comp4500 = number_format($price_comp4500, 2);
$price_enh500 = $price_enh500 + $price2_enh500 + $price3_enh500 + $price4_enh500 + $price5_enh500 + $price6_enh500 + $price7_enh500;
$price_enh500 = number_format($price_enh500, 2);
$price_enh750 = $price_enh750 + $price2_enh750 + $price3_enh750 + $price4_enh750 + $price5_enh750 + $price6_enh750 + $price7_enh750;
$price_enh750 = number_format($price_enh750, 2);
$price_enh1250 = $price_enh1250 + $price2_enh1250 + $price3_enh1250 + $price4_enh1250 + $price5_enh1250 + $price6_enh1250 + $price7_enh1250;
$price_enh1250 = number_format($price_enh1250, 2);
$price_enh1850 = $price_enh1850 + $price2_enh1850 + $price3_enh1850 + $price4_enh1850 + $price5_enh1850 + $price6_enh1850 + $price7_enh1850;
$price_enh1850 = number_format($price_enh1850, 2);
$price_enh2500 = $price_enh2500 + $price2_enh2500 + $price3_enh2500 + $price4_enh2500 + $price5_enh2500 + $price6_enh2500 + $price7_enh2500;
$price_enh2500 = number_format($price_enh2500, 2);
$price_enh5500 = $price_enh5500 + $price2_enh5500 + $price3_enh5500 + $price4_enh5500 + $price5_enh5500 + $price6_enh5500 + $price7_enh5500;
$price_enh5500 = number_format($price_enh5500, 2);
$price_enh9500 = $price_enh9500 + $price2_enh9500 + $price3_enh9500 + $price4_enh9500 + $price5_enh9500 + $price6_enh9500 + $price7_enh9500;
$price_enh9500 = number_format($price_enh9500, 2);
$price_hsa1700 = $price_hsa1700 + $price2_hsa1700 + $price3_hsa1700 + $price4_hsa1700 + $price5_hsa1700 + $price6_hsa1700 + $price7_hsa1700;
$price_hsa1700 = number_format($price_hsa1700, 2);
$price_hsa2750 = $price_hsa2750 + $price2_hsa2750 + $price3_hsa2750 + $price4_hsa2750 + $price5_hsa2750 + $price6_hsa2750 + $price7_hsa2750;
$price_hsa2750 = number_format($price_hsa2750, 2);
$price_hsa5400 = $price_hsa5400 + $price2_hsa5400 + $price3_hsa5400 + $price4_hsa5400 + $price5_hsa5400 + $price6_hsa5400 + $price7_hsa5400;
$price_hsa5400 = number_format($price_hsa5400, 2);
$price_value2000 = $price_value2000 + $price2_value2000 + $price3_value2000 + $price4_value2000 + $price5_value2000 + $price6_value2000 + $price7_value2000;
$price_value2000 = number_format($price_value2000, 2);
$price_value5000 = $price_value5000 + $price2_value5000 + $price3_value5000 + $price4_value5000 + $price5_value5000 + $price6_value5000 + $price7_value5000;
$price_value5000 = number_format($price_value5000, 2);
$price_basic3000 = $price_basic3000 + $price2_basic3000 + $price3_basic3000 + $price4_basic3000 + $price5_basic3000 + $price6_basic3000 + $price7_basic3000;
$price_basic3000 = number_format($price_basic3000, 2);
$price_basic5000 = $price_basic5000 + $price2_basic5000 + $price3_basic5000 + $price4_basic5000 + $price5_basic5000 + $price6_basic5000 + $price7_basic5000;
$price_basic5000 = number_format($price_basic5000, 2);
}
mysql_close($connect);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Multiquote Insurance Quote</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<script type="text/javascript" src="flashobject.js"></script>
</head>
<body>
<div align="center">
<table border="0" width="778" cellspacing="0" cellpadding="0" id="table1" class="main">
<tr>
<td class="header" colspan="2">
<a href="http://www.iowahealthinsurance.biz/">
<img border="0" src="images/logo.gif" width="569" height="160"></a></td>
</tr>
<tr>
<td class="formtitle" colspan="2">Instant Health Insurance Quote</td>
</tr>
<tr>
<td align="center" width="493"> </td>
<td align="right" width="265">
<div id="steps">
<a target="_blank" href="http://www.macromedia.com/go/getflashplayer/">
<img src="images/get_flash_player.gif" width="88" height="31" border="0"></a>
</div>
<script type="text/javascript">
var fo = new FlashObject("step2.swf", "movie", "195", "43", "5", "#F1E1CE");
fo.addParam("wmode", "transparent");
fo.write("steps");
fo.addVariable("variable", "varvalue");
</script>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="0" id="table2">
<tr>
<td colspan="2">
<img border="0" src="images/logo-bcbs.gif" width="153" height="44"></td>
</tr>
<?php
If ($error == "yes") {
?>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td class="information" colspan="2" bgcolor="#9D0710">
<font color="#FFFFFF">We only provide instant quotes for persons who are <?php echo $max_age; ?> years of age or less. Please call 1-866-820-1739 if you or any of your dependents do not meet this age requirement.</font></td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<?php
} Else {
?>
<tr>
<td class="information" colspan="2">For more
information on each plan group, click where indicated.
All deductibles, coinsurance and maximum out-of-pocket
listed are for single coverage. <i>The prices
listed below in red is the total monthly cost for the
applicant/dependent information you provided.</i>
<font color="#000080">To apply online</font>,
select a plan and hit "apply online".
<font color="#FF0000"> All Wellmark plans have a $9.25 monthly service fee not included in quotes.</td>
</tr>
<tr>
<td width="27%" class="grouptitle">Comprehensive Plan
(PPO)</td>
<td width="73%"> <a target="_blank" href="http://www.iowahealthinsurance.biz/asooc07.pdf"><img border="0" src="images/more-info.gif" width="144" height="17"></a></td>
</tr>
<tr>
<td width="100%" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table3" class="plans">
<tr>
<td class="grouptitle2">Comprehensive 500</td>
<td class="grouptitle2">Comprehensive 1000</td>
<td class="grouptitle2">Comprehensive 1500</td>
<td class="grouptitle2">Comprehensive 3000</td>
<td class="grouptitle2">Comprehensive 4500</td>
</tr>
<tr>
<td class="groupfields">Deductible: $500<br>
Coinsurance: 10%<br>
Out-of-Pocket $1,500</td>
<td class="groupfields">Deductible: $1,000<br>
Coinsurance: 10%<br>
Out-of-Pocket $2,000</td>
<td class="groupfields">Deductible: $1,500<br>
Coinsurance: 10%<br>
Out-of-Pocket $2,500</td>
<td class="groupfields">Deductible: $3,000<br>
Coinsurance: 10%<br>
Out-of-Pocket $4,000</td>
<td class="groupfields">Deductible: $4,500<br>
Coinsurance: 10%<br>
Out-of-Pocket $5,500</td>
</tr>
<tr>
<td class="quoteprices">
<?php echo $price_comp500; ?></td>
<td class="quoteprices">
<?php echo $price_comp1000; ?></td>
<td class="quoteprices">
<?php echo $price_comp1500; ?></td>
<td class="quoteprices">
<?php echo $price_comp3000; ?></td>
<td class="quoteprices">
<?php echo $price_comp4500; ?></td>
</tr>
<tr>
<form method="post" action="hi_application.php" name="quote2">
<?php
foreach($_POST as $key=>$value){
if ($key!="submit"){
$value=htmlentities(stripslashes(strip_tags($value)));
echo "\t<input type=\"hidden\" name=\"$key\" value=\"$value\">\n";
}
}
?>
<input type="hidden" name="dob_applicant" value="<?php echo $dob_applicant; ?>">
<input type="hidden" name="dob_spouse" value="<?php echo $dob_spouse; ?>">
<input type="hidden" name="dob_child1" value="<?php echo $dob_child1; ?>">
<input type="hidden" name="dob_child2" value="<?php echo $dob_child2; ?>">
<input type="hidden" name="dob_child3" value="<?php echo $dob_child3; ?>">
<input type="hidden" name="dob_child4" value="<?php echo $dob_child4; ?>">
<input type="hidden" name="dob_child5" value="<?php echo $dob_child5; ?>">
<input type="hidden" name="no_dependents" value="<?php echo $no_dependents; ?>">
<input type="hidden" name="plan" value="<?php echo $plan; ?>">
<td class="groupfields">
<input type="radio" value="comp500" name="plan" tabindex="1">
</td>
<td class="groupfields">
<input type="radio" value="comp1000" name="plan" tabindex="2"></td>
<td class="groupfields">
<input type="radio" value="comp1500" name="plan" tabindex="3"></td>
<td class="groupfields">
<input type="radio" value="comp3000" name="plan" tabindex="3"></td>
<td class="groupfields">
<input type="radio" value="comp4500" name="plan" tabindex="5"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" colspan="2"> </td>
</tr>
<tr>
<td width="27%" class="grouptitle">Enhanced Plan (PPO)</td>
<td width="73%"> <a target="_blank" href="http://www.iowahealthinsurance.biz/asooc07.pdf"><img border="0" src="images/more-info.gif" width="144" height="17"></a></td>
</tr>
<tr>
<td width="100%" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table4" class="plans">
<tr>
<td class="grouptitle2">Enhanced 750</td>
<td class="grouptitle2">Enhanced 1250</td>
<td class="grouptitle2">Enhanced 1850</td>
<td class="grouptitle2">Enhanced 2500</td>
<td class="grouptitle2">Enhanced 5500</td>
<td class="grouptitle2">Enhanced 9500</td>
</tr>
<tr>
<td class="groupfields">Deductible: $750<br>
Coinsurance: 20%<br>
Out-of-Pocket $1,750</td>
<td class="groupfields">Deductible: $1,250<br>
Coinsurance: 20%<br>
Out-of-Pocket $2,250</td>
<td class="groupfields">Deductible: $1,850<br>
Coinsurance: 20%<br>
Out-of-Pocket $2,850</td>
<td class="groupfields">Deductible: $2,500<br>
Coinsurance: 20%<br>
Out-of-Pocket $3,500</td>
<td class="groupfields">Deductible: $5,500<br>
Coinsurance: 20%<br>
Out-of-Pocket $6,500</td>
<td class="groupfields">Deductible: $9,500<br>
Coinsurance: 20%<br>
Out-of-Pocket $10,500</td>
</tr>
<tr>
<td class="quoteprices">
<?php echo $price_enh750; ?></td>
<td class="quoteprices">
<?php echo $price_enh1250; ?></td>
<td class="quoteprices">
<?php echo $price_enh1850; ?></td>
<td class="quoteprices">
<?php echo $price_enh2500; ?></td>
<td class="quoteprices">
<?php echo $price_enh5500; ?></td>
<td class="quoteprices">
<?php echo $price_enh9500; ?></td>
</tr>
<tr>
<td class="groupfields">
<input type="radio" value="enhanced750" name="plan" tabindex="10">
</td>
<td class="groupfields">
<input type="radio" value="enhanced1250" name="plan" tabindex="11"></td>
<td class="groupfields">
<input type="radio" value="enhanced1850" name="plan" tabindex="111"></td>
<td class="groupfields">
<input type="radio" value="enhanced2500" name="plan" tabindex="12"></td>
<td class="groupfields">
<input type="radio" value="enhanced5500" name="plan" tabindex="13"></td>
<td class="groupfields">
<input type="radio" value="enhanced9500" name="plan" tabindex="14"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" colspan="2"> </td>
</tr>
<tr>
<td width="27%" class="grouptitle">HSA Plan</td>
<td width="73%"> <a target="_blank" href="http://www.iowahealthinsurance.biz/hsaooc07.pdf"><img border="0" src="images/more-info.gif" width="144" height="17"></a></td>
</tr>
<tr>
<td width="100%" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table5" class="plans">
<tr>
<td class="grouptitle2">HSA 1700</td>
<td class="grouptitle2">HSA 2750</td>
<td class="grouptitle2">HSA 5400</td>
</tr>
<tr>
<td class="groupfields">Deductible: $1,700<br>
Coinsurance: 0%<br>
Out-of-Pocket $1,700</td>
<td class="groupfields">Deductible: $2,750<br>
Coinsurance: 0%<br>
Out-of-Pocket $2,750</td>
<td class="groupfields">Deductible: $5,400<br>
Coinsurance: 0%<br>
Out-of-Pocket $5,400</td>
</tr>
<tr>
<td class="quoteprices">
<?php echo $price_hsa1700; ?></td>
<td class="quoteprices">
<?php echo $price_hsa2750; ?></td>
<td class="quoteprices">
<?php echo $price_hsa5400; ?></td>
</tr>
<tr>
<td class="groupfields">
<input type="radio" value="hsa1700" name="plan" tabindex="20">
</td>
<td class="groupfields">
<input type="radio" value="hsa2750" name="plan" tabindex="21"></td>
<td class="groupfields">
<input type="radio" value="hsa5400" name="plan" tabindex="22"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" colspan="2"> </td>
</tr>
<tr>
<td width="27%" class="grouptitle">Value Plan (PPO)</td>
<td width="73%"> <a target="_blank" href="http://www.iowahealthinsurance.biz/asooc07.pdf"><img border="0" src="images/more-info.gif" width="144" height="17"></a></td>
</tr>
<tr>
<td width="100%" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table6" class="plans">
<tr>
<td class="grouptitle2">Value 2000</td>
<td class="grouptitle2">Value 5000</td>
</tr>
<tr>
<td class="groupfields">Deductible: $2,000<br>
Coinsurance: 40%<br>
Out-of-Pocket $4,000</td>
<td class="groupfields">Deductible: $5,000<br>
Coinsurance: 40%<br>
Out-of-Pocket $10,000</td>
</tr>
<tr>
<td class="quoteprices">
<?php echo $price_value2000; ?></td>
<td class="quoteprices">
<?php echo $price_value5000; ?></td>
</tr>
<tr>
<td class="groupfields">
<input type="radio" value="value2000" name="plan" tabindex="30">
</td>
<td class="groupfields">
<input type="radio" value="value5000" name="plan" tabindex="31"></td>
</tr>
</table><br>
</td>
</tr>
<tr>
<td width="27%" class="grouptitle">Basic Plan
(PPO)</td>
<td width="73%"> <a target="_blank" href="http://www.iowahealthinsurance.biz/wellmark/basic.pdf"><img border="0" src="images/more-info.gif" width="144" height="17"></a></td>
</tr>
<tr>
<td width="100%" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table3" class="plans">
<tr>
<td class="grouptitle2">Basic 3000</td>
<td class="grouptitle2">Basic 5000</td>
</tr>
<tr>
<td class="groupfields">Deductible: $3,000<br>
Coinsurance: 50%<br>
Out-of-Pocket $5,000 in network</td>
<td class="groupfields">Deductible: $5,000<br>
Coinsurance: 50%<br>
Out-of-Pocket $7,000 in network</td>
</tr>
<tr>
<td class="quoteprices">
<?php echo $price_basic3000; ?></td>
<td class="quoteprices">
<?php echo $price_basic5000; ?></td>
</tr>
<tr>
<form method="post" action="hi_application.php" name="quote2">
<td class="groupfields">
<input type="radio" value="basic3000" name="plan" tabindex="51">
</td>
<td class="groupfields">
<input type="radio" value="basic5000" name="plan" tabindex="52"></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td colspan="2">
<p align="center"><input type="submit" name="submit" value="Apply Online" class="submit" tabindex="50"></form></p></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td class="footer" colspan="2"> </td>
</tr>
<?php
}
?>
</table>
</div>
</body>
</html>