ryanhart Posted April 13, 2009 Share Posted April 13, 2009 I have a 4-step form (ex. quote.php, quote2.php, quote3.php, quote4.php). I use PHP to pass the variables from quote.php => quote2.php => quote3.php, etc... All the variables are passed successfully except TWO... - insured_1_health_conditions - insured_1_health_conditions_detail These 2 form variables are located on quote2.php, then passed to quote3.php. Live example... http://www.livehealthinsurance.com/quote.php Below is the code, that is relevant in solving this problem. JavaScript in Head Content - quote2.php <script type="text/javascript"> <!-- function setConditions() { document.getElementById("insured_1_health_conditions_detail").value=(((document.getElementById("aids").checked)?"HIV/AIDS / ":"")+""+((document.getElementById("diabetes").checked)?"Diabetes / ":"")+""+((document.getElementById("cancer").checked)?"Cancer / ":"")+""+((document.getElementById("heart-attack").checked)?"Heart Attack / ":"")+""+((document.getElementById("high-blood-pressure").checked)?"High Blood Pressure / ":"")+""+((document.getElementById("pregnant").checked)?"Pregnant / ":"")+""+((document.getElementById("stroke").checked)?"Stroke / ":"")+""+((document.getElementById("depression").checked)?"Depression / ":"")+""+((document.getElementById("other-illness").checked)?"Other major illness not listed. / ":"")); } function unSetConditions() { document.getElementById("aids").checked=false;document.getElementById("diabetes").checked=false;document.getElementById("cancer").checked=false;document.getElementById("heart-attack").checked=false;document.getElementById("high-blood-pressure").checked=false;document.getElementById("pregnant").checked=false;document.getElementById("stroke").checked=false;document.getElementById("depression").checked=false;document.getElementById("other-illness").checked=false; document.getElementById("insured_1_health_conditions_detail").value=""; } --> </script> Form - quote2.php <form action="quote3.php" method="post" name="healthquote" id="healthquote"> <!--VARIABLES PASSED FROM - HOME PAGE--> <input type="hidden" name="address_1_state" id="address_1_state" value="<?=$_POST['address_1_state']; ?>" /> <!--VARIABLES PASSED FROM - QUOTE.PHP--> <input type="hidden" name="insured_1_gender" value="<?=$_POST['insured_1_gender']; ?>"> <input type="hidden" name="insured_1_dobMM" value="<?=$_POST['insured_1_dobMM']; ?>"> <input type="hidden" name="insured_1_dobDD" value="<?=$_POST['insured_1_dobDD']; ?>"> <input type="hidden" name="insured_1_dobYYYY" value="<?=$_POST['insured_1_dobYYYY']; ?>"> <input type="hidden" name="insured_1_heightFT" value="<?=$_POST['insured_1_heightFT']; ?>"> <input type="hidden" name="insured_1_heightIN" value="<?=$_POST['insured_1_heightIN']; ?>"> <input type="hidden" name="insured_1_weight" value="<?=$_POST['insured_1_weight']; ?>"> <div id="inner-form"> <table cellpadding="10" cellspacing="0" border="0" class="maintable"> <tbody> <tr> <td width="167" style="border-bottom: 1px solid #EFDCB4;">Currently Insured?</td> <td width="77" style="border-bottom: 1px solid #EFDCB4;"><input type="radio" name="insured_1_currently_covered" id="insured_1_currently_covered" value="yes" /> Yes </td> <td width="362" style="border-bottom: 1px solid #EFDCB4;"><input type="radio" name="insured_1_currently_covered" id="insured_1_currently_covered" value="no" checked /> No </td> </tr> <tr> <td style="border-bottom: 1px solid #EFDCB4;">Smoker?</td> <td style="border-bottom: 1px solid #EFDCB4;"><input type="radio" name="insured_1_smoker" id="insured_1_smoker" value="yes" /> Yes </td> <td style="border-bottom: 1px solid #EFDCB4;"><input type="radio" name="insured_1_smoker" id="insured_1_smoker" value="no" checked /> No </td> </tr> <tr> <td>Medical Conditions?</td> <td><input type="radio" name="insured_1_health_conditions" id="insured_1_health_conditions_yes" value="yes" onClick="if(this.checked){document.getElementById('conditions').style.display='';}" /> Yes </td> <td><input type="radio" name="insured_1_health_conditions" id="insured_1_health_conditions_no" value="no" onClick="if(this.checked){document.getElementById('conditions').style.display='none';}unSetConditions();" checked /> No </td> </tr> </tbody> </table> <table cellpadding="4" cellspacing="0" border="0" id="conditions" style="border-top: 1px solid #EFDCB4; display: none; margin-bottom: 10px; margin-right: 10px; margin-left: 10px; width: 565px;"> <tbody> <tr> <td width="139" style="padding-top: 10px;"><input type="checkbox" id="aids" onClick="setConditions();" /> HIV/Aids</td> <td width="243" style="padding-top: 10px;"><input type="checkbox" id="diabetes" onClick="setConditions();" /> Diabetes</td> <td width="272" style="padding-top: 10px;"><input type="checkbox" id="cancer" onClick="setConditions();" /> Cancer</td> </tr> <tr> <td><input type="checkbox" id="heart-attack" onClick="setConditions();" /> Heart Attack</td> <td><input type="checkbox" id="high-blood-pressure" onClick="setConditions();" /> High Blood Pressure</td> <td><input type="checkbox" id="pregnant" onClick="setConditions();" /> Pregnant</td> </tr> <tr> <td><input type="checkbox" id="stroke" onClick="setConditions();" /> Stroke</td> <td><input type="checkbox" id="depression" onClick="setConditions();" /> Depression (requiring medication)</td> <td><input type="checkbox" id="other-illness" onClick="setConditions();" /> Other Major Illness</td> </tr> </tbody> </table> </div> <div id="buttonCont"> <div id="buttons"> <input type="image" src="_img/continue-button-green.jpg" style="padding:0; padding-right: 20px; padding-top:0px;" onClick="return validateHealth2(this.form);" /> </div> </div> </form> Hidden form fields for quote3.php <!--VARIABLES PASSED FROM - HOME PAGE--> <input type="hidden" name="address_1_state" id="address_1_state" value="<?=$_POST['address_1_state']; ?>" /> <!--VARIABLES PASSED FROM - QUOTE1.PHP--> <input type="hidden" name="insured_1_gender" value="<?=$_POST['insured_1_gender']; ?>"> <input type="hidden" name="insured_1_dobMM" value="<?=$_POST['insured_1_dobMM']; ?>"> <input type="hidden" name="insured_1_dobDD" value="<?=$_POST['insured_1_dobDD']; ?>"> <input type="hidden" name="insured_1_dobYYYY" value="<?=$_POST['insured_1_dobYYYY']; ?>"> <input type="hidden" name="insured_1_heightFT" value="<?=$_POST['insured_1_heightFT']; ?>"> <input type="hidden" name="insured_1_heightIN" value="<?=$_POST['insured_1_heightIN']; ?>"> <input type="hidden" name="insured_1_weight" value="<?=$_POST['insured_1_weight']; ?>"> <!--VARIABLES PASSED FROM - QUOTE2.PHP--> <input type="hidden" name="insured_1_smoker" value="<?=$_POST['insured_1_smoker']; ?>"> <input type="hidden" name="insured_1_currently_covered" value="<?=$_POST['insured_1_currently_covered']; ?>"> <input type="hidden" name="insured_1_health_conditions" value="<?=$_POST['insured_1_conditions']; ?>"> <input type="hidden" name="insured_1_health_conditions_detail" value="<?=$_POST['insured_1_health_conditions_detail']; ?>"> I'm stumped, please help... Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/153891-passing-form-variables-multi-page-form/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.