Saturday, November 04, 2006

Contact Form Script

This is a contact form script. It's easy to use and install. You only need a .cgi hosting or if you don't have .cgi in your hosting you can also use other free hosting like netfirms.com for this email script. Below is the instruction on how to use the email script.


1.) Copy and save the email script into email.cgi, and upload it into your web sever. But if you dont have a cgi in your websever try to use the free hosting netfirms.com which they supported free cgi. This is the example url or location of the email script. http://www.exinrex.netfirms.com/cgi-bin/email.cgi.

Note: change the below example email address("example\@yahoo.com") in your own email address. You just remain \ between the name email and the site. And also change the "Thankyoupages.html" in your own thank you page.

$email = param('email');
$subject = param('subject');

$name = param('name');
$message = param('message');


$mailprog = '/usr/sbin/sendmail';


$myemail = "example\@yahoo.com";

open (MAIL, "|$mailprog -t") or die "Can't send mail.$!\n";
print MAIL "To: $myemail\n";
print MAIL "From: $email\n";
print MAIL "Subject: $subject\n";
print MAIL "\n";
print MAIL "=====================================================\n";

print MAIL "Sender Name: $name\n";
print MAIL "Message: $message\n";
print MAIL "\n";
close(MAIL);

print "Location: Thankyoupages.html\n\n";



2.) Copy the below Html file and save it or If you already have a website you only need is to insert the form tags into your html page. and change the location of the email script of form action tag.

Note: <form action="location of the email script " method="post"> example location of the email script. http://www.exinrex.netfirms.com/cgi-bin/email.cgi


<html>

<head>

<title>sample</title>

</head>

<body>

<form action="http://www.exinrex.netfirms.com/cgi-bin/email.cgi" method="post">


Name: <input type="text" name="name" size ="20"><br>

Email Address: <input type="text" name="email" size ="20"><br>

Subject: <input type="text" name="subject" size ="20"><br>

Message: <textarea name="message" cols="60" rows="6"></textarea><br>

<input type="submit" value="Submit">

</form>

</body>


</html>


If you successfully run the contact form script you now install form validation. Form validation is to validate input data in HTML forms before sending off the content to a server. For more info regarding the script of form validation visit http://www.formassembly.com.

Have Fun !

No comments: