PDA

View Full Version : Need Contact form...



baldrn
09-24-2008, 10:01 PM
I need a simple contact form..
Name, email address, etc, and then a "submit" button to send the typed info to a hidden email address.
With fields that I can customize.
Any suggestions?
Thanks

tacticious
09-24-2008, 10:42 PM
I need a simple contact form..
Name, email address, etc, and then a "submit" button to send the typed info to a hidden email address.
With fields that I can customize.
Any suggestions?
Thanks

This is the wrong forum to post this in, as Javascript cannot send information to an email address.

You'll need to write/get a script. In order to get a script you'll have to determine which scripting language you'd prefer. If you've got a web host right now, you should know what scripting language/s it supports. Most likely, if it's a windows based server you'll have ASP. If it's Linux, you'll probably have PHP.

Once you've determined your preferred scripting language, you can find very well written scripts on websites like Hot Scripts (http://www.hotscripts.com). However, scripts are generally like thumb prints. No two will be the same, and however close to your purpose one is it will probably not be EXACTLY what you want. If this is the case, you'll probably want one either written for you or you'll write one yourself. To get one written for you, go someplace like the request forum here at DD. In your case, someone may offer to write bits of code to help you along for free, as this is a very simple script.

One thing is, if you'd like customizable fields in the form, you're going to also need a database engine. If you're on a windows server, you'll probably have MS SQL, Linux should have MySQL. If you don't have one you'll need one as there are very few scripts that will work without one (using files instead, which is inefficient).

If you choose the path of writing your own, I can help you create it so you can get an understanding of your script rather than just copy and paste. I use PHP, so I'll provide a bit of resources and snippets to get you started. If you require further assistance let me know.

Check this link out:

php.net - Mail function (http://us2.php.net/manual/en/function.mail.php)

So, in your form page you'd have something like this:


<html>
<head>
<title>My Form</title>
</head>
<body>
<form action='submit.php' method='post'>
<center>
<table width='85%' border='0'>
<tr><td>First Name:</td><td><input type='text' name='firstname'></td></tr>
<tr><td>Last Name:</td><td><input type='text' name='lastname'></td></tr>
<tr><td>FEmail:</td><td><input type='text' name='email'></td></tr>
<tr><td colspan='2'><center><input type='submit' name='submit' value='Submit'>&nbsp;<input type='clear'></td></tr>
</table>
</center>
</form>
</body>
</html>


In submit.php:


<?
$first = $_POST['firstname'];
$last = $_POST['lastname'];
$email = $_POST['email'];

// Subject of the email
$subject = "New form data";

// Body of the email
$message = "You have new form data:\n\nFirst name: " . $first . "\nLast name: " . $last . "\nEmail: " . $email;

////////////////////////////////////////////
// Change this to your email address //
////////////////////////////////////////////
$myemail = "admin@somewebsite.com";

$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($myemail, $subject, $message, $headers);
?>


The snippets above would require one to edit the form page manually to change/add/remove fields for the user to fill in. Dynamic forms would require a bit more work, and is a bit more complicated. You'd be best off either having someone write it for you (at a price) or searching for a free script somewhere.

karim
04-14-2009, 03:26 PM
You may want to see this site: http://www.bestwebforms.com, where 50 customizable forms offered, all hosted or downloadable to your website