PDA

View Full Version : Forms


Jittor
12-06-2005, 02:27 PM
Hello,


I have created a form in DW and have it set up so the submit button will email me all the info but I would also like it to redirect them to another page after that. How do I make the submit button perform 2 actions? Thanks

davidj
12-06-2005, 02:38 PM
add a hidden field within your form with a value of 1

make your form action submit to itself (same page as form) then process form

example...pseudo code

variable1 = formcontents1[content1];
variable2 = formcontents2[content2];
variable3 = formcontents3[hiddenfield]; <<<
etc

if (variable3 !=''){ //** only process this form if hidden field IS NOT empty

sendmail() //** this is where you will add your email function

redirect_to_page() //** this is where you will add your redirect function

}

Jittor
12-06-2005, 03:00 PM
I donít fully understand. I know HTML but I am not that familiar with other codes. Can you further explain? I am posting my code for the form (minus some states so it wont be as long). Can you walk me through this? I really want to learn this.


<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<table width="600" height="563" border="0" align="center">
<tr>
<td></td>
</tr>
<tr>
<td height="532"> <form action="mailto:sample@sample.com" method="post" enctype="text/plain" name="Advertising" id="Advertising">
<table width="97%" border="2" align="center" cellspacing="1" bordercolor="#FFFF99">
<tr>
<td bgcolor="#FFFFCC"> <fieldset>
<legend><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Contact
Information - Parts marked <font color="#FF0000">*</font> must
be filled out in order to Submit Form!</font></legend>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Contact
Name<font color="#FF0000">*</font></font> </div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Contact Name" type="text" id="Contact Name4" size="25" maxlength="50">
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Address<font color="#FF0000">*</font></font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Address" type="text" id="Address3" size="30" maxlength="70">
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">City<font color="#FF0000">*</font>
</font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="City" type="text" id="City3" size="25" maxlength="50">
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">State<font color="#FF0000">*</font></font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="select" id="select6">
<option value="AK">ALASKA </option>
<option value="AL">ALABAMA</option>
<option value="AR">ARKANSAS</option>
<option value="AZ">ARIZONA </option>
<option value="Please Select" selected>-- Please Select
--</option>
</select>
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Zip
Code<font color="#FF0000">*</font></font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Zip Code2" type="text" id="Zip Code22" size="15" maxlength="15">
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Phone<font color="#FF0000">*</font></font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Phone" type="text" id="Phone3" size="15" maxlength="20">
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email<font color="#FF0000">*</font></font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="Email" type="text" id="Email3" size="40" maxlength="70">
</font></td>
</tr>
<tr>
<td><div align="right">Number of Dogs</div></td>
<td><label for="textfield"></label> <input type="text" name="textfield" id="textfield"></td>
</tr>
<tr>
<td><div align="right">
<label for="label2">Name of Dogs</label>
</div></td>
<td><label for="label"></label> <input type="text" name="textfield2" id="label"></td>
</tr>
</table>


</p>
</fieldset></td>
</tr>
<tr>
<td height="196" bgcolor="#FFFFCC"> <fieldset>
<legend><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Questions
and Comments</font></legend>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">

</font>
<table width="95%" border="0" align="center" cellspacing="5">
<tr>
<td width="100%"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Please
add additional comments or questions in the space provided
below.
<textarea name="Please add additional comments or questions in the space provided below." cols="40" rows="4" id="textarea4"></textarea>
</font></div></td>
</tr>
</table>
<p align="center">
<label>
<input name="Submit" type="submit" onClick="MM_validateForm('Contact Name4','','R','Address3','','R','City3','','R','Zi p Code22','','R','Phone3','','R','Email3','','R');re turn document.MM_returnValue" value="Submit">
</label>

<label>
<input name="Clear Form" type="reset" id="Clear Form2" value="Reset">
</label>
</p>
</fieldset></td>
</tr>
</table>
</form></td>
</tr>
</table>
</BODY>

davidj
12-06-2005, 03:06 PM
you need to learn a scripting language

php is very popular and very powerful although there are others

you need a host with php support or you need to install php on your local machine

Jittor
12-06-2005, 03:25 PM
I am using DW now. What do you mean by "you need to install php on your local machine "? Any recomendations on where to start to learn php or another scripting language. I know some CSS.

davidj
12-06-2005, 03:28 PM
try this link

installing WAMP (windows, apache, Mysql, PHP) ('http://www.puremango.co.uk/cm_wamp_97.php')

Jittor
12-06-2005, 03:32 PM
Thats awesome - Untill next time Davidj - Thnaks for the help and advice :D