What's the problem? [Still need help!]
Posted: Sat Dec 11, 2004 8:01 pm
Alright, I have no clue where the problem is in the code. Can someone please help me out? I took the code out in snippets and could not find a problem...
Code: Select all
<?php
$question1 = file_get_contents('question1.html');
$question2 = file_get_contents('question2.html');
$question3 = file_get_contents('question3.html');
$question4 = file_get_contents('question4.html');
$question5 = file_get_contents('question5.html');
if(isset($_POST['submit'])) {
extract($_POST);
if (empty($budget)) {
if (!empty($how_many)) $currentquestion = $question2;
if (!empty($purchase_price AND $down_payment)) $currentquestion = $question3;
if (!empty($credit_history)) $currentquestion = $question4;
if (!empty($gross_income AND $month_debt)) $currentquestion = $question5;
$form = "<form name ="myform" method="post" action="".$_SERVER['PHP_SELF']."">"; //beginning of the form
$form .= $currentquestion;
if (!empty($how_many)) $form .= "<input type="hidden" name="how_many" value="".$how_many."">";
if (!empty($purchase_price AND $down_payment)) {
$form .= "<input type="hidden" name="purchase_price" value="".$purchase_price."">";
$form .= "<input type="hidden" name="down_payment" value="".$down_payment."">";
}
if (!empty($credit_history)) $form .= "<input type="hidden" name="credit_history" value="".$credit_history."">";
if (!empty($gross_income AND $month_debt)) {
$form .= "<input type="hidden" name="gross_income" value="".$gross_income."">";
$form .= "<input type="hidden" name="month_debt" value="".$month_debt."">";
}
$form .= "<input type="submit" value="Submit" name="submit">"; //submit button
$form .= "</form>"; //end of form
echo $form;
} else {
echo "here is the final data.<p><pre>";
print_r ($_POST);
echo "</pre>";
}
} else {
$currentquestion = $question1;
$form = "<form name ="myform" method="post" action="".$_SERVER['PHP_SELF']."">";
$form .= $currentquestion;
$form .= "<input type="submit" value="Submit" name="submit">";
$form .= "</form>";
echo $form;
}
?>