View Full Version : An email input form*


Lees
03-02-2007, 07:37 PM
I want a form like the first one on this page: http://www.move4modesty.com/contact.htm

I've looked at codes for these forms already
and tried to build one myself, but I can't really figure out how
to do it. Please help, and thanks for your time!

Lees*

amyaurora
03-02-2007, 07:44 PM
To do it yourself you'll need more advanced scripting such as php and/or cgi. It can't be done with HTML alone.

Lees
03-02-2007, 08:01 PM
Oh. Well I have these codes:


<FORM METHOD="POST"
ACTION="http://web.mit.edu/bin/cgiecho/wwwdev/cgiemail/questions3.txt">

Your e-mail address: <INPUT NAME="email"><p>
Your name: <INPUT NAME="yourname"><p>
Your quest: <INPUT NAME="quest"><p>
Your favourite colour: <INPUT NAME="colour"><p>
<INPUT TYPE="submit" value="Send e-mail">
</FORM>


Do you know what else I'd need add to them to make them work?

amyaurora
03-02-2007, 08:07 PM
Yes you need a cgi script and you need to make sure your host supports cgi. I don't know which script you need because each form is differnt. Where did you get the script because it should have been provided? Unless you got it from someones page source. (Bad idea to copy and paste someones codes) If that is so you'll need to go back to their site and see if they list somewhere they got their script at. Also you can try to use Google to look for email forms and cgi scripts.

Idiotic Creation
03-04-2007, 03:56 PM
Hey, check if your host supports PHP, if they do you can use this script:

Just change the bolded items to your own information. This page needs to have a .php extension and the action of the form (I bolded it) needs to be what ever you name this page.
<?php
$start = $_POST['send'];
if (isset($start)) {
$name = $_POST['name'];
$location = $_POST['location'];
$email = $_POST['email'];
$found = $_POST['found'];
$comments = $_POST['comments'];
$ip = $_SERVER['REMOTE_ADDR'];
$time = date('m/d/y g:i a');
$allgo = true;

if (empty($name)) {
$allgo = false;
echo "<font face='arial' color='black' size='2'>You must enter your name (or at least a made up one) to send feedback.</font><br>";
}
if (empty($location)) {
$allgo = false;
echo "<font face='arial' color='black' size='2'>You must enter your location (I promise I wont stalk you) to send feedback.</font><br>";
}
if (empty($email)) {
$allgo = false;
echo "<font face='arial' color='black' size='2'>You must enter your email address (or I wont get the feedback) to send feedback.</font><br>";
}
if (empty($comments)) {
$allgo = false;
echo "<font face='arial' color='black' size='2'>Ehmmm, you have to type in the feedback, if you want to send it to me.</font>";
}

if ($allgo) {
$to = 'admin@opticalmusic.net';
$subject = 'Optical Music Feedback';
$message = 'A user has sent feedback for Optical Music

Name: ' . $name . '
From: ' . $location . '
Arrived Via: ' . $found . '

Message:
-------------------------------
' . $comments . '
-------------------------------

For refrence the ip address of the sender is: ' . $ip . '
And this message was submited by the sender at: ' . $time . '

This script brought to you by David Findley';
$from = $email;
$headers = 'From: ' . $from;
if (mail ($to,$subject,$message,$headers)) {
echo "<font face='Arial Rounded MT Bold' color='black' size='4'><b>Thank you for your feedback!</b></font><br><br><font face='arial' color='black' size='2'>Your feedback will be anaylized over a period of several days using a method where we fast and carefully consider each suggestion.<br><br>No, I am messing with you, but we really do appricate input from our community.</font>";
}
else {
echo "<font face='arial' color='black' size='2'>Oops! Our server exploded just as you were sending your feedback. Please try again later.</font>";
}
}
$_POST['send'] = "\0";
}
else {
echo "
<form method='post' action='http://www.opticalmusic.net/index.php?id=feedback'>
<table width='100%' cellspacing='10' cellpadding='0' border='0'>
<tr valign='top'>
<td align='right'><font face='arial' color='black' size='2'>Name: </font></td><td><input type='text' size='40' name='name'></td>
</tr>
<tr valign='top'>
<td align='right'><font face='arial' color='black' size='2'>Location: </font></td><td><input type='text' size='40' name='location'></td>
</tr>
<tr valign='top'>
<td align='right'><font face='arial' color='black' size='2'>Email: </font></td><td><input type='text' size='40' name='email'</td>
</tr>
<tr valign='top'>
<td align='right'><font face='arial' color='black' size='2'>Found Us Via: </font></td><td><select name='found'><option selected='yes'>Google</option><option>Other search engine</option><option>Link from another website</option><option>A friend told me</option><option>An enemy told me</option><option>Was offered candy</option><option>Typed random letters into the address bar</option></select></td>
</tr>
<tr valign='middle'>
<td align='right'><font face='arial' color='black' size='2'>Message: </font></td><td><textarea name='comments' rows='15' cols='40'></textarea></td>
</tr>
<tr valign='top'>
<td colspan='2' align='center'><input type='submit' name='send' value='Send'></td>
</tr>
</table>
</form>";
}
?>

David