-
Web forms?
what program would I use to make forms on my website, like if i wanted to have "contact us" page where there is a spot to write your name and your email address and a think to write your message and then a button for submit? What program would i use? how do i do it?
the website was build in macromedia fireworks
-
if you have php on your web server
here is the complete generic form that I use on websites where possible. It involves php, the first part needs to be placed on the page you wish the form to be on (or you can add html and body tags to the beginning and end and use it as is) the second part is the script that processes the form to send it to you. Notice the part where it says to change the email address. The entire second part needs to go into its own file (contactscript.php is what the form calls for) I will check back to see if you have any questions.
The code is:
The Contact Form that I use for generic purposes
---------------------------------------------------------------------------------------------------------------------------------------------------------
<form action="contactscript.php" method="post" enctype="multipart/form-data" name="Contact">
<table width="570" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td width="20" height="20"> </td>
<td height="20" colspan="3"> </td>
<td width="20" height="20"> </td>
</tr>
<tr>
<td width="20" rowspan="7" bgcolor="#FFFFFF"> </td>
<td width="255" height="60" class="text">
<div align="left">Name: <font color="#FF0000">*</font>
<input name="name" type="text" size="40" maxlength="40">
</div></td>
<td width="20" height="60" class="text">
<div align="left"></div></td>
<td width="255" height="60" class="text">
<div align="left">Email: <font color="#FF0000">*
</font>
<input name="email" type="text" size="40" maxlength="40">
</div></td>
<td width="20" rowspan="7" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td width="255" height="60" class="text">
<div align="left">Address:
<input name="add1" type="text" size="40" maxlength="50">
</div></td>
<td width="20" height="60" class="text">
<div align="left"></div></td>
<td width="255" height="60" class="text">
<div align="left">Day Phone:<br>
<input name="phone" type="text" size="12" maxlength="12">
</div></td>
</tr>
<tr>
<td width="255" height="60" class="text">
<div align="left">Address:
<input name="add2" type="text" size="40" maxlength="50">
</div></td>
<td width="20" height="60" class="text">
<div align="left"></div></td>
<td width="255" height="60" class="text">
<div align="left"></div></td>
</tr>
<tr>
<td height="60" colspan="3" class="text">
<div align="left">City: &n bsp;
&n bsp;
&n bsp; State: &nbs p;
Zip: <br>
<input name="city" type="text" size="25" maxlength="25">
<input name="state" type="text" size="5" maxlength="2">
<input name="zip" type="text" size="11" maxlength="10">
</div>
<div align="left"></div>
<div align="left"> </div></td>
</tr>
<tr>
<td height="60" colspan="3" class="text">
<div align="left">Subject: <font color="#FF0000">*</font><br>
<input name="subject" type="text" size="40" maxlength="40">
</div>
<div align="left"></div>
<div align="left"></div></td>
</tr>
<tr>
<td height="60" colspan="3" class="text">
<div align="left">Comments:<font color="#FF0000">*</font><br>
<textarea name="comments" cols="40" rows="5" wrap="PHYSICAL"></textarea>
</div>
<div align="left"></div>
<div align="left"></div></td>
</tr>
<tr>
<td width="255" height="60" class="text">
<div align="right">
<input type="submit" name="Submit" value="Send">
</div></td>
<td width="20" height="60" class="text">
<div align="center"></div></td>
<td width="255" height="60" class="text">
<div align="left">
<input name="Reset" type="reset" id="Reset2" value="Reset">
</div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="20" height="20"> </td>
<td height="20" colspan="3" class="text"> </td>
<td width="20" height="20"> </td>
</tr>
</table></form>
----------------------------------------------------------------------------------------------------------------------------------------------
The PHP script that I use to process the form
----------------------------------------------------------------------------------------------------------------------------------------------
<?php
$name = trim($HTTP_POST_VARS["name"]);
$email = trim($HTTP_POST_VARS["email"]);
$phone = trim($HTTP_POST_VARS["phone"]);
$add1 = trim($HTTP_POST_VARS["add1"]);
$add2 = trim($HTTP_POST_VARS["add2"]);
$city = trim($HTTP_POST_VARS["city"]);
$state = trim($HTTP_POST_VARS["state"]);
$zip = trim($HTTP_POST_VARS["zip"]);
$subject = trim($HTTP_POST_VARS["subject"]);
$comments = trim($HTTP_POST_VARS["comments"]);
$toaddress = "spamsucks@ispamspammers.com"; //change this address for other sites
$mailcontent = "Name: "."\n".$name."\n"."\n"
."Email Address: "."\n".$email."\n"."\n"
."Daytime Phone: "."\n".$phone."\n"."\n"
."Address: "."\n".$add1."\n".$add2."\n".$city." ".$state." "." ".$zip."\n"."\n"
."Subject: "."\n".$subject."\n"."\n"
."Comments: "."\n".$comments."\n";
$fromaddress = $email;
mail($toaddress, $subject, $mailcontent, $fromaddress);
?>
<html>
<body>
<p class="text"> </p>
<table width="760" height="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><p align="center" class="text"><strong><font size="5">Message Sent</font></strong></p>
<p align="center" class="text">Your message has been sent to us, we will
respond as quickly as possible.</p>
<p align="center" class="text">Thank you.</p>
</td>
</tr>
</table>
</html>
</body>
-
Question about your script. I have it working fine, but I see that you have a ; in many places. What does ; represent within the script?
Pardon the ignorance, new to this stuff.
-
Disregard the last post. I figured it out 
[Edited on 23-9-2003 by technodoh]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules