View Full Version : CGI / PHP Email Form


Xiphias
04-28-2003, 11:01 AM
does anybody know how to MAKE (not use people's like bravenet's) a CGI / Perl or PHP contact form? thx

pb&j
04-28-2003, 01:09 PM
there are tons to use here...
http://www.hotscripts.com

alkaline39
04-28-2003, 02:55 PM
heres the one i use, its solely php

this is the form for filling out the email

<form action="formmail.php" method="POST">
<p align="center">
Your Name:<br>
<input type="text" size="27" name="name" class="form"><br />
Your Email Address:<br />
<input type="text" size="27" name="email" class="form"><br />
Subject:<br />
<select name="subject" class="form">
<option value="Question">Question</option>
<option value="Comment">Comment</option>
<option value="Service Request">Service Request</option>
</select><br />

Questions /Comments:<br />
<textarea name="comments" rows="5" cols="39" class="form"></textarea><br>
<br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="clear" value="Clear"></p>
</form>



this page should be called formmail.php , and just fill in to with your email address

<?php

#recipient's email address
$to = "your@emailaddress.com";

#subject of the message
$re = $subject;
$extras = "----------------------------\n" . "· Host: \t\t[ " . $REMOTE_ADDR . " ] " . gethostbyaddr($REMOTE_ADDR) . "\n· Client: \t\t[ " . $ip . " ] " . gethostbyaddr($ip) . "\n· User Agent: \t" . $HTTP_USER_AGENT;


#message from the contact form
$msg = "\n\nName: $name\n\nE-Mail Address: $email\n\nComments:\n$comments";

#send the email
mail ($to, $re, $msg, $extras);


?>

<html>
<head>
<title>Cyto Designs - Thank You For Your Email</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta HTTP-EQUIV="REFRESH" CONTENT="3; URL=index.php">
</head>

<body>
<center>
<table border="0" cellspacing="1" cellpadding="0" bgcolor="B3B209" width="250">
<tr>
<td>
<table border="1" cellspacing="0" cellpadding="2" bgcolor="F2F1E8" width="100%" bordercolor="F3F3D8">
<tr>
<td valign="top" align="center">
Thank you for your email. You will now be redirected to the home page.
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>

</body>
</html>