E-mail Form...

Started on the old forum in December 2007 · view the original in the archive · old links redirect here

12 replies · 930 views · started 18 years ago · 1 min read

5 participants
WhiteWarrior Principal · 1,419 posts #1

Ok had a few inboxes asking about a E-Mail Form...

Create contact.php insert this

<!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>Contact WhiteWarrior</title>
<style type="text/css">
.box { margin-top: 0px; margin-bottom: 0px; margin-left: 100px; width: 500px; padding: 5px; background-color: silver; color: blue; }

form { border: 6px solid lightgrey; padding: 5px; background-color: silver; }

input { background-color: lightgrey; color: blue; }

select { background-color: darkgray; color: blue; }

input.radio { background-color: blue; }

textarea { background-color: lightgrey; color: blue; }

.button { font-size: 16px; font-family: Lucida Calligraphy; background-color: darkgray; color: blue; }

</style>
</head>
<body>

<form method="post" action="sendmail.php">

<?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: 

<input type="text" name="visitor" size="35" />

Your Email:

<input type="text" name="visitormail" size="35" />

Whats It About?:

<select name="attn" size="1">
<option value=" General Question ">General Question</option>
<option value=" Need Help ">Need Help</option>
</select>

Mail Message:

<textarea name="notes" rows="4" cols="40"></textarea>

<input type="submit" value="Send Mail" />
</form>

</body>
</html>

Then make a file called sendmail.php and insert

<!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>Sent</title>
<style type="text/css">
.box { margin-top: 0px; margin-bottom: 0px; margin-left: 100px; width: 500px; padding: 5px; background-color: silver; color: blue; }

form { border: 6px solid lightgrey; padding: 5px; background-color: silver; }

input { background-color: lightgrey; color: blue; }

select { background-color: darkgray; color: blue; }

input.radio { background-color: blue; }

textarea { background-color: lightgrey; color: blue; }

.button { font-size: 16px; font-family: Lucida Calligraphy; background-color: darkgray; color: blue; }

</style>
</head>
<body>

<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];

if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
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;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a");

$attn = $attn;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
About: $attn \n\n
Message: $notes \n\n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";

mail("YOUR EMAIL HERE", $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?>

Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )

About: <?php echo $attn ?>

Message:

<?php $notesout = str_replace("\r", "
", $notes);
echo $notesout; ?>

<?php echo $ip ?>

[url="index.php"]Back[/url]
</p>

</body>
</html>

Upload It Then Its Done... Remember To Change the e-mail to your email address.

alexism Developer · 136 posts #2

Parse error: parse error, unexpected ';' in /home/www/xxxxxxxxxx/web/sendmail.php on line 74

WhiteWarrior Principal · 1,419 posts #3

on the sendmail.php edit the line

mail("YOUR EMAIL HERE", $subject, $message, $from);

To just your email address... remove the colour parts because the bbcode must have been changed on this site

metulj Super moderator Principal · 1,726 posts #5

these codes are all copy paste from http://www.ibdhost.com/contact/ External image (may be gone) not ur own codes except for the styles External image (may be gone)

so what if its copy/paste ???

he didnt said its his script... and unlike you he share things at least External image (may be gone)

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

alexism Developer · 136 posts #6

where must i put my email?i hv try but the email was not send to my email..

WhiteWarrior Principal · 1,419 posts #10

Ok your sendmail.php will be this....

<!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>Sent</title>
<style type="text/css">
.box { margin-top: 0px; margin-bottom: 0px; margin-left: 100px; width: 500px; padding: 5px; background-color: silver; color: blue; }

form { border: 6px solid lightgrey; padding: 5px; background-color: silver; }

input { background-color: lightgrey; color: blue; }

select { background-color: darkgray; color: blue; }

input.radio { background-color: blue; }

textarea { background-color: lightgrey; color: blue; }

.button { font-size: 16px; font-family: Lucida Calligraphy; background-color: darkgray; color: blue; }

</style>
</head>
<body>

<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];

if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
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;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a");

$attn = $attn;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
About: $attn \n\n
Message: $notes \n\n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";

mail("alexis.m_3487@yahoo.com", $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?>

Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )

About: <?php echo $attn ?>

Message:

<?php $notesout = str_replace("\r", "
", $notes);
echo $notesout; ?>

<?php echo $ip ?>

[url="index.php"]Back[/url]
</p>

</body>
</html>
alexism Developer · 136 posts #12

thanks a lot white warruor..can u give me the wml version?

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close