Hiya, I need some help. Ive designed a form in
PHP but I just can't seem to get it to work. Here are the 2 pages, the first is contact.
php (
http://unsc.awardspace.co.uk/contact.php), nd when they send it, it goes to sendeail.
php (
http://unsc.awardspace.co.uk/sendeail.php).
Heres the code for Contact (Well the main form
php)
- PHP: Select all
<form method="post" action="sendeail.php">
<p>
<span class="style4">
<?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 ?>" />
Officers Name:
<input type="text" name="visitor2" size="35" />
<br />
Users Name:
<input type="text" name="visitor" size="35" />
<br />
Your Email:
<input type="text" name="visitormail" size="35" />
<br />
Promote/Demote:
<select name="attn" size="1">
<option value=" promote ">Promote </option>
<option value=" demote ">Demote </option>
</select>
<br />
Reason (Must Include Date): </span><br />
<textarea name="notes" rows="10%" cols="50%"></textarea>
<br />
<input type="submit" value="Send Mail" />
<br />
</p>
</form>
And heres the sendeail.
php code
- PHP: Select all
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
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 (eregi('http:', $notes)) {
die ("Do NOT try that!! You N00B! ");
}
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("jjpeacha104@hotmail.com", $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 ?>
Can you see anything wrong with them?
Jjpeacha