desk2web
06-11-2006, 08:55 PM
I need to make a simple 2 part form, first part collects a single piece of data input by the visitor, that information is passed to a second form where more information is collected and then all the data is sent via an email to a given address.
I can create simple forms to do these individually, but I do not know how to pass the first criterion to the second form.
Help - suggestions - decent web link tutorials appreciated.
Thanks
mitchlrm
06-11-2006, 09:51 PM
Take a look at Javascript.
Fixago
06-11-2006, 10:21 PM
Just store the variables from the first form as hidden variables on the form. I assume you're using PHP right? I also don't see why you can't just have the form post to itself, and then after the first form is posted, show the second form and hide the first. That way you keep it all on one page.
For example, in the first form, you ask for say, their first name and you're using the POST method. The first form's action is to the second form. Just put this on the top of the second form:
$fname = $_POST["fname"];
"fname" is the name you named (wow that sounds weird) you the input field for the first form. Then, now that you have that variable stored as $fname, just include an INPUT HIDDEN variable and echo out <?=$fname?> for the value.
Jatinder
06-12-2006, 01:55 PM
You will need to create hidden fields in the second form. Set the values of these hidden fields to those submitted in the first form. See example below:
form1.php
<form id="form1" name="form1" method="post" action="form2.php">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="122">First Name </td>
<td width="178"><input name="fname" type="text" id="fname"></td>
</tr>
<tr>
<td>Last Name </td>
<td><input name="lname" type="text" id="lname"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
form2.php
<form id="form2" name="form2" method="post" action="register.php">
<input name="fname" type="hidden" id="fname" value="<?php print($_POST['fname']);?>">
<input name="lname" type="hidden" id="lname" value="<?php print($_POST['lname']);?>">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="122">Email </td>
<td width="178"><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td>Address</td>
<td><input name="address" type="text" id="address"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
desk2web
06-12-2006, 03:14 PM
Just what I needed, thanks very much :)