PDA

View Full Version : Need Contact Us Form



DJ_CJ
21-01-2007, 03:12 PM
Hi, does any one have or know where i can get a working contact us form?
+rep if you do

RNelson
21-01-2007, 03:14 PM
Name contact.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Form </title>
</head>
<body>
<form method="post" action="sendeail.php">
<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />

Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
<br />
Attention:<br />
<select name="attn" size="1">
<option value=" Sales n Billing ">Sales n Billing </option>
<option value=" General Support ">General Support </option>
<option value=" Technical Support ">Technical Support </option>
<option value=" Webmaster ">Webmaster </option>
</select>
<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
</form>
</body>
</html>


Name sendmail.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>
<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->
<?php
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";

mail("YourEmail", $subject, $message, $from);
?>
<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />
Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>
<br /><br />
<a href="contact.php"> Next Page </a>
</p>
</body>
</html>

PinkFM
21-01-2007, 03:16 PM
<?php
// Change these two variables to meet your needs.
$myemail = 'EMAIL ADRESS HERE';
$subject = 'EMAIL SUBJECT HERE';
$op = $_POST[op];
if($op == 'contact')
{
$name = stripslashes($_POST[name]);
$email = stripslashes($_POST[email]);
$text = stripslashes($_POST[text]);
$referer = $_POST[referer];
$remote_host = $_SERVER[REMOTE_ADDR];
$server = $_SERVER[SERVER_NAME];
$browser = $_SERVER[HTTP_USER_AGENT];
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$email))
{
$status = "We're sorry, but you've entered an incorrect email address.<br>";
}
if(!$name)
{
$status .= "Please enter your name.<br>";
}
if(!$text)
{
$status .= "Please enter a message.<br>";
}
if(!$status)
{
$header = "From: $email\r\nReply-To: $email\r\n";
$message = "
Name: $name
Referer: $referer
Site: $server
Remote Host: $remote_host
Remote Browser: $browser
$text
";
if(mail($myemail, $subject, $message, $header))
{
$status = "Thank you for your Feedback!!<br><br>";
}
else
{
$status = "There was a problem sending your feedback, please try again later.<br><br>";
}
}
else
{
$status .= "<br>Please press <u>back</u> on your browser to resubmit.<br><br>";
}
}
// Now check the referer page and ensure it's a proper URL
$referer = $_SERVER[HTTP_REFERER];
if(!preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $referer))
{
unset($referer);
}
?>
<?php print $status; ?>
<form method="post" action="<?php print $_SELF; ?>">
<input type="hidden" name="op" value="contact">
<input type="hidden" name="referer" value="<?php print $referer; ?>">
<font face="Verdana" size="1">
Habbo Name<br>
<input name="name" size="35" value=""><br>
E-mail address<br><input name="email" size="35" value=""><br>
<br>Message<br><textarea name="text" cols="30" rows="10"></textarea><br><br>
<input type="submit" value="Send"></font>

DJ_CJ
21-01-2007, 03:20 PM
ty both of you :D +rep

Drompo
21-01-2007, 03:20 PM
Tell me what fields you want and i'll make you one

DJ_CJ
21-01-2007, 03:34 PM
could you make one with loads of empty spaces to put the fields in?

Drompo
21-01-2007, 03:39 PM
The Field names have to comply with the $post names

What fields do you want and i will make them.

Also what kind i.e Textarea, Text, checkbox

Want to hide these adverts? Register an account for free!