I manage to do 2 forms in 2 diferent php files.
1 form in each page.
The 1st one has a form with a basic contact info and an attached file
and the second form has a list of questions with checkboxes.
In the first form I have 2 buttond (reset and continue) and the second form also has 2 buttons (reset and send).
After sending the information everything is send to an email.
My only problem now is that I have to validate first the information put in the first form and then display the second page with the second form.
This is what I did:
Th first form1.php has the following:
Code: Select all
<form action="acghsformv3f2.php" method="get" enctype="multipart/form-data" name="form1">
<!-- The questions of the form -->
<input type="submit" name="Submit" value="Continue">
</form>Code: Select all
<body>
<?php
if ($_SERVER['REQUEST_METHOD']=="POST")
{
// In here I put the validations of the second form.
// If I put the validation of the first form they will occur after the second
// form is process (notice the POST) and I need them to occur after the first
// form and before opening the second form.
// But if I put something similar in the first Form then the second will never
// be open because I will have to change the action and method of the
// first form.
//
// I HOPE THIS IS CLEAR
// If validations are ok send an email
}
else
{ ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form2">
<!-- The questions of the form -->
<input type="submit" name="Submit" value="Submit">
<?php
// This is what will capture the values from the first form and put them
// in hidden fields to be send after. Notice that it must be inside the form.
$name; // Represents the name of the elements in $HTTP_POST_VARS
$value; // Represents the value of the elements in $HTTP_POST_VARS
// Do while there is an element in $HTTP_POST_VARS...
while (list($name, $value) = each($HTTP_POST_VARS))
// Construct a hidden input field.
// Then go back to the beginning of the loop and do the same thing.
{
echo "<input type=\"hidden\" value=\"$value\" name=\"$name\">\n";
}
?>
</form>
<?php
} ?>
</body>the logical flow should goes like this:
Form1 (form1.php)
* If the request isn't a form submission, show the form.
* If the request is a form submission, validate the submitted parameters.
* If the submitted parameters are invalid, show the form again.
* If the submitted parameters are valid, open second form.
Form2 (form2.php)
* If the request isn't a form submission, show the form.
* the values from form1 are stored in hidden fields in the form2.
* If the request is a form submission, validate the submitted parameters.
* If the submitted parameters are invalid, show the form again.
* If the submitted parameters are valid, send everything by email.
Thanks again...