/    Sign up×
Community /Pin to ProfileBookmark

PHP & emailing a form

Uggh,

Having a terrible time figuring out what I am doing wrong. PHP support is loaded on the server. I am having an issue getting the form to be sent via email after all the data is entered and the send button is pressed. I’m a n00b to PHP, but I want to use it more if I can get it to work correctly, lol. Any help would be wonderful. Thanks in advance.

<html>

<head>
<meta http-equiv=”Content-Language” content=”en-us”>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<title>GNFL Submission Form</title>
</head>

<body>

<table border=”0″ width=”100%” id=”table3″ height=”218″>
<tr>
<td>
<div align=”center”>
<center>
<table id=”table4″ style=”border-collapse: collapse” borderColor=”#111111″ cellSpacing=”0″ cellPadding=”0″ width=”690″ border=”0″>
<tr>
<td align=”middle” width=”204″ rowSpan=”7″>
<font face=”Verdana”>
<img height=”162″ src=”gnfl1.gif” width=”125″ align=”left” border=”0″>&nbsp;
&nbsp; </font></td>
<td width=”554″>&nbsp;</td>
</tr>
<tr>
<td width=”554″>&nbsp;</td>
</tr>
<tr>
<td align=”middle” width=”554″><font face=”Verdana”><b>
<font size=”5″>G</font><font size=”4″>RIDIRON&nbsp; </font>
<font size=”5″>N</font><font size=”4″>ATION</font>
<font size=”5″>F</font><font size=”4″>OOTBALL&nbsp; </font>
<font size=”5″>L</font><font size=”4″>EAGUE<img height=”58″ src=”gnfltrophy.gif” width=”34″ border=”0″></font></b></font><p>
<b><font face=”Verdana” size=”5″>S</font></b><font face=”Verdana”><b><font size=”4″>UBMISSION</font>
<font size=”5″>F</font><font size=”4″>ORM</font></b></font></td>
</tr>
</table>
</center></div>
</td>
</tr>
</table>
<table border=”0″ width=”100%” id=”table5″ height=”50″>
<tr>
<td>
<p align=”center”>** ALL CHANGES DEADLINE IS 7:00 P.M. WEDNESDAY**<br>
#1 – Defensive Playbooks and Profiles are combined. <br>
#2 – Specific stipulations &amp; PLAYER CHANGES for 2nd half changes Should be
listed below.<br>
#3 – ANY player movement should be detailed below.(Trades, FA requests,
roster moves, etc.)</td>
</tr>
</table>
<form method=”POST” action=”gnfl.php”>

<p>&nbsp; Team&nbsp; <select size=”1″ name=”Team”>
<option> </option>
<option>Prichard Wolfpack</option>
<option>Myers Stampede</option>
</select>

&nbsp;&nbsp; Week&nbsp; <select size=”1″ name=”Week”>
<option> </option>
<option>EVERY WEEK</option>
<option>Pre-Season</option>
<option>Play Offs</option>
</select>

&nbsp;&nbsp;&nbsp; Your E-Mail Address&nbsp;
<input type=”text” name=”Emailfrom” size=”35″></p>

<p>1st Half Offense Playbook&nbsp;
<select size=”1″ name=”OffPB1″>
<option> </option>
<option>GNFL</option>
<option>WFL</option>
</select>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1st Half Offensive
Profile&nbsp;&nbsp;
<select size=”1″ name=”OffPR1″>
<option> </option>
<option>Classic Run</option>
<option>Classic Balanced</option>
</select>

&nbsp;&nbsp;&nbsp; 1st Half Defense&nbsp;&nbsp;
<select size=”1″ name=”DEF1″>
<option> </option>
<option>4 – 3 Run</option>
<option>4 – 3 Pass</option>
</select></p>

<p>2nd Half Offense Playbook
<select size=”1″ name=”OffPB2″>
<option> </option>
<option>GNFL</option>
</select>
; 2nd Half Offensive
Profile&nbsp;
<select size=”1″ name=”OffPR2″>
<option> </option>
<option>Classic Run</option>
<option>Classic Balanced</option>
</select>

&nbsp;&nbsp;&nbsp; 2nd Half Defense&nbsp;
<select size=”1″ name=”DEF2″>
<option> </option>
<option>4 – 3 Run</option>
<option>4 – 3 Pass</option>
</select></p>

<p>Do you want ONE or TWO Kick Returners when receiving a kick off?
<INPUT type=radio name=”radiokr”>ONE
<INPUT type=radio name=”radiokr” CHECKED>TWO (Default)

<p>Do you want to use the &quot;White Shoes&quot; Punt coverage formation (chances of a blocked punt are increased, but hang time is longer)?
<INPUT type=radio name=”radiows”>YES
<INPUT type=radio name=”radiows” CHECKED>NO (Default)

<p>2ND HALF STIPULATIONS – PLAYBOOK/PROFILE CHANGE&nbsp; (Please be
specific to score, weather, etc.)</p>
<p>&nbsp; Change #1&nbsp;&nbsp;IF <input size=”47″ name=”change1a”> THEN SWITCH TO
<input size=”47″ name=”change1b”></p>
<p>&nbsp; Change #2&nbsp;&nbsp;IF <input size=”47″ name=”change2a”> THEN SWITCH TO
<input size=”47″ name=”change2b”></p>

<p>&nbsp;&nbsp; 2ND HALF PERSONNEL STIPULATIONS AND CHANGES<br>
&nbsp;&nbsp; You may select up to 2 Player personnel changes @ half time. You may
select to substitute player’s) regardless of<br>
&nbsp;&nbsp; statistical happening OR use statistics at half as a stipulation. PLEASE,
be specific as to the personnel change<br>
&nbsp;&nbsp; &amp; the stipulation (if applies). Example: Rushing stats below 50 yards,
change HB’s as follows: HB1 Jackson, HB2 <br>
&nbsp;&nbsp; Heyward, HB3 Word. OR, no stipulation. Example: At half bench HB Heyward,
making HB1 Jackson, HB2 Heyward, HB3 Word.</p>
<p>&nbsp;&nbsp; Player Change #1&nbsp;&nbsp; <input size=”132″ name=”PlayerChange1″></p>
<p>&nbsp;&nbsp; Player Change #2&nbsp;&nbsp; <input size=”132″ name=”PlayerChange2″></p>

<p>&nbsp;&nbsp; ROSTER CHANGES</p>
<p>&nbsp;&nbsp; <textarea name=”RosterChanges” rows=”16″ cols=”77″></textarea></p>
<p align=”center”><input type=”submit” name=”submit” value=”Submit”></p>
</form>

</body>

</html>

<?php

// get posted data into local variables
$EmailTo = “GNFL Commissioner <[email protected]>”;
$Team = Trim($_POST[Team]);
$Week = Trim($_
POST[Week]);
$Emailfrom = Trim($_POST[Emailfrom]);
$OffPB1 = Trim($_
POST[OffPB1]);
$OffPR1 = Trim($_POST[OffPR1]);
$Def1 = Trim($_
POST[Def1]);
$OffPB2 = Trim($_POST[OffPB2]);
$OffPR2 = Trim($_
POST[OffPR2]);
$Def2 = Trim($_POST[Def2]);
$radiokr = Trim($_
POST[radiokr]);
$radiows = Trim($_POST[radiows]);
$change1a = Trim($_
POST[change1a]);
$change1b = Trim($_POST[change1b]);
$change2a = Trim($_
POST[change2a]);
$change2b = Trim($_POST[change2b]);
$PlayerChange1 = Trim($_
POST[PlayerChange1]);
$PlayerChange2 = Trim($_POST[PlayerChange2]);
$RosterChanges = Trim($_
POST[RosterChanges]);

// prepare email body text
// tells you that the mail is sent from this form
$Body .= “GNFL Submission Informationn”;
$Body .= “Team: $Teamn”;
$Body .= “Week: $Weekn”;
$Body .= “Email from: $Emailfromn”;
$Body .= “Offensive Playbook 1st Half: $OffPB1n”;
$Body .= “Offensive Profile 1st Half: $OffPR1n”;
$Body .= “Defensive Playbook & Profile 1st Half: $Def1n”;
$Body .= “Offensive Playbook 2nd Half: $OffPB2n”;
$Body .= “Offensive Profile 2nd Half: $OffPR2n”;
$Body .= “Defensive Playbook & Profile 2nd Half: $Def2n”;
$Body .= “ONE or TWO Kick Returners when receiving a kick off: $radiokrn”;
$Body .= “Use the “White Shoes” Punt coverage formation: $radiowsn”;
$Body .= “2ND HALF STIPULATIONS Change #1**IF $change1a THEN SWITCH TO $change1bn”;
$Body .= “2ND HALF STIPULATIONS Change #2**
IF $change2a THEN SWITCH TO $change2bn”;
$Body .= “2ND HALF PERSONNEL: Player Change #1:**$PlayerChange1n”;
$Body .= “2ND HALF PERSONNEL: Player Change #2:**
$PlayerChange2n”;
$Body .= “Roster Changes: $RosterChangesn”;

// send email
$success = mail($Emailfrom, $Team, $Week);

// redirect to success page
if ($success){print “<meta http-equiv=”refresh” content=”0;URL=GNFLreceived.htm”>”;}
else{print “<meta http-equiv=”refresh” content=”0;URL=no.htm”>”;}

?>

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@niconel_comJun 01.2007 — You are posting an awefull lot of non-essential code, no wonder no one answered. Even myself dont bother reading code in forum post like this.

I suggest you first create a simple form with values hard-coded in, upload it to your server, and see if it works

[CODE] <?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is test email message.";
$from = "[email protected]";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>[/CODE]

Then ,take it from there. If it does not work, it's your server configuration. If it does, its probably how you use forms.
×

Success!

Help @davisninjas spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...