Information on FORMS for Feedback or Contact Pages - Updated!

admin

Administrator
Staff member
Want to save information from a form to a file or email it to yourself? You can't use HTML for this, you need a server side languages. There are many such languages that you can use, like PHP, ASP, ASP.net, CGI-Perl, JSP, ColdFusion, ect. <br />
<br />
First, find out what your host supports and then you can learn the apporpriate language.<br />
<br />
If your just starting out I suggest making your post in the CGI-Perl forum.<br />
<br />
Thank you,<br />
Compguy Pete<!--content-->For any form action you need a server side technology, the most common is a form mailer, this takes the results of a form and mails it to the address specified.<br />
<br />
Not all servers/hosting support server side technologys, but there are many free form mailers available on the net for you to use.<br />
<br />
I recommend using this script if you server does not support a server side technology (Coded by me)<br />
Original Source (<!-- m --><a class="postlink" href="http://php.richardturner.com/mailer.php">http://php.richardturner.com/mailer.php</a><!-- m -->)<br />
<br />
//Dont forget to replace the email and thankyou page to your own<br />
<form action="http://php.richardturner.com/mailer.php" method="post"><br />
<p><br />
<input type="hidden" name="form_email" value="YOUR_EMAIL@DOMAIN" /><br /><br />
<input type="hidden" name="form_thankyou" value="http://www.YOURSITE.com/THANKYOUPAGE.HTML" /><br /><br />
Your Form Here<br /><br />
<input type="submit" value="Submit" /><br />
</p><br />
</form><br />
<br />
<br />
or if you server supports PHP (Coded by pyro (<!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/member.php?s=&action=getinfo&userid=728">http://www.webdeveloper.com/forum/membe ... userid=728</a><!-- m -->) )<br />
Original Source (<!-- m --><a class="postlink" href="http://www.webdevfaqs.com/php.php#mailer">http://www.webdevfaqs.com/php.php#mailer</a><!-- m -->) <br />
<br />
<?PHP<br />
<br />
#######################################################<br />
# This script is Copyright 2003, Infinity Web Design #<br />
# Distributed by <!-- m --><a class="postlink" href="http://www.webdevfaqs.com">http://www.webdevfaqs.com</a><!-- m --> #<br />
# Written by Ryan Brill #<br />
# All Rights Reserved - Do not remove this notice #<br />
#######################################################<br />
<br />
## The lines below need to be edited...<br />
<br />
###################### Set up the following variables ######################<br />
#<br />
$to = "[email protected]"; #set address to send form to<br />
$subject = "Results from your Request Info form"; #set the subject line<br />
$headers = "From: Form Mailer"; #set the from address, or any other headers<br />
$forward = 0; # redirect? 1 : yes || 0 : no<br />
$location = "thankyou.htm"; #set page to redirect to, if 1 is above<br />
#<br />
##################### No need to edit below this line ######################<br />
<br />
## set up the time ##<br />
<br />
$date = date ("l, F jS, Y");<br />
$time = date ("h:i A");<br />
<br />
## mail the message ##<br />
<br />
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";<br />
<br />
if ($_SERVER['REQUEST_METHOD'] == "POST") {<br />
foreach ($_POST as $key => $value) {<br />
$msg .= ucfirst ($key) ." : ". $value . "\n";<br />
}<br />
}<br />
else {<br />
foreach ($_GET as $key => $value) {<br />
$msg .= ucfirst ($key) ." : ". $value . "\n";<br />
}<br />
}<br />
<br />
mail($to, $subject, $msg, $headers);<br />
if ($forward == 1) {<br />
header ("Location:$location");<br />
}<br />
else {<br />
echo "Thank you for submitting our form. We will get back to you as soon as possible.";<br />
}<br />
<br />
?> <br />
<br />
<br />
or if you server supports ASP<br />
//Coming Soon EDIT: See Below Post By Dave//<!--content-->Well as Rich said, ASP solution coming soon so here it is. I've made an example form in HTML Strict 4.01 and there's also the script itself in a separate .asp file.<br />
<br />
It's pretty simple to use, the form submits to the ASP file which processes the info and then redirects the user to another page. All you have to do is open up the ASP file in notepad and fill in values for 3 variables:SMTPserver= "xxx.xxx.xxx.xxx"' Specify a valid SMTP mail server.<br />
redir= "http://www.w3.org/"' Specify a page to redirect the user to once they have submitted the form.<br />
recipient= "[email protected]"' Specify who to send the email to.<!--content-->Note, the Persits AspEmail component must be installed and configured on the server for the ASP example to work. AspEmail is available on most modern Windows Servers. See the Persits Web Site (<!-- m --><a class="postlink" href="http://www.persits.com">http://www.persits.com</a><!-- m -->) for more information.<br />
<br />
Regards.<!--content-->
 
Back
Top