Forum Moderators: coopster
<?php
/*subject and email definitions */
$emailSubject = 'Live-Ops Signup Please';
$webMaster = 'webmaster@example.com';
$req = '1';
/*data to be sent */
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$nameField = $_POST['name'];
$teamnameField = $_POST['teamname'];
$gameField = $_POST['game'];
$numberField = $_POST['number'];
$timeslotField = $_POST['timeslot'];
$body = <<<EOD
<br><hr><br>
Email: $email <br>
Contact Phone Number: $phone <br>
Name: $name <br>
Team Name: $teamname <br>
Number of Members on Team: $number <br>
Timeslot Requested: $timeslot <br>
Which Type of game they want: $game <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/*results rendered as html*/
$theResults = <<<EOD
<html>
<head>
<title>Live-ops</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {
background-color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
body,td,th {
color: #FFFFFF;
}
-->
</style>
</head>
<div>
<div align="left">
<p>Thank you for using our web signup form. You will get a verification email as soon as we get your email and slot you in for the time that you requested. If we cannot do so, you will get an email letting you know the timeslot is not available. You may view the schedule with updated open slots below at the <a href="Schedule.htm">schedule</a> link.</p>
<p> You may also check our online calendar to see if your timeslot has been assigned to you. </p>
<p> See you at Live-ops!</p>
</div>
</div>
<div align="center">
<h5><font color="#CCCCCC"><a href="Videos.htm">VIDEOS</a> ¦ <a href="Contact.htm">CONTACT</a> ¦ <a href="Sponsor.htm">SPONSOR</a> ¦ <a href="Photos.htm">PHOTOS</a> ¦ <a href="calendar/calendar.htm">SCHEDULE</a></font></h5>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
[edited by: eelixduppy at 3:18 pm (utc) on Oct. 18, 2008]
[edit reason] exemplified [/edit]
$emailField = $_POST['email'];
[..]
Email: $email <br>
You haven't defined $email anywhere. Try using $emailField instead (the same goes for many other variables in the script).
Tip: use
error_reporting(E_ALL) [php.net];at the top of your script while you're testing it. That will inform you about errors like this.
You may also wish to read up on email header injection [google.com], to prevent abuse of the script.
And welcome to WebmasterWorld!
above $success = mail($webMaster, $emailSubject, $body, $headers);
add this line
echo $body;
then comment out $success = mail($webMaster, $emailSubject, $body, $headers);
then "send" the email as is. It won't send the email but just spit out your email body so you can see if everything looks right before trying to send it proper.
Good luck!