Please help! Major issue with php email form

Please help! The forms on a website I’m working on have stopped functioning properly. First they were sending blank emails, then I made a couple of changes and some of the fields are appearing in the email but none of the values are. My PHP knowledge is pretty limited so I would truly appreciate anyone’s help with this. I didn’t create or set up these forms - they were already in place when I began working on the website.

Form code:

</td>			<td align="center" valign="top" width="260">				<table align="CENTER" bgcolor="#660000" border="0" cellpadding="5" cellspacing="0">					<tbody><tr>						<td colspan="2" align="center"><font color="#FFFFFF" face="arial" size="2"><b>Request A Quote!</b></font></td>					</tr>					<FORM style="border: 1px dotted red; padding: 2px" style="border: 1px dotted red; padding: 2px" action="../../life_submit.php" accept-charset="UTF-8" method="post"></form>						<tr>							<td class="form_text" valign="top">First Name*<br>								<input name="First Name" size="16" style="BACKGROUND-COLOR: #E5E5E5"></td>							<td class="form_text" valign="top">Last Name*<br>								<input name="Last Name" size="16" value="" style="BACKGROUND-COLOR: #E5E5E5"></td>						</tr>						<tr>							<td class="form_text" valign="top">Phone Number*<br>								<input name="Phone" size="16" value="" style="BACKGROUND-COLOR: #E5E5E5"></td>							<td class="form_text" valign="top">Cell Phone*<br>								<input name="Cell Phone" size="16" value="" style="BACKGROUND-COLOR: #E5E5E5"></td>						</tr>						<tr>							<td colspan="2" class="form_text" valign="top">Email Address*<br>								<input name="Email" size="40" value="" style="BACKGROUND-COLOR: #E5E5E5"></td>						</tr>						<tr>							<td colspan="2" class="form_text" valign="top">Street Address<br>								<input name="Street Address" size="40" value="" style="BACKGROUND-COLOR: #E5E5E5"></td>						</tr>						<tr>							<td colspan="2" class="form_text" valign="top">City, State  ZIP<br>								<input name="City, State  ZIP" size="40" value="" style="BACKGROUND-COLOR: #E5E5E5"></td>						</tr>						<tr>							<td colspan="2" class="form_text" valign="top">Comments*<br>								<textarea class="form_body" style="BACKGROUND-COLOR: #E5E5E5" name="Comments" rows="6" cols="30" type="reset" input="" value=""></textarea></td>						</tr>						<tr>							<td colspan="2" style="BACKGROUND-COLOR: transparent" align="center">								<p><a href="http://www.nhins.com/life_submit.php"><input src="../../images/submit.jpg" value="About submit buttons" alt="[Submit]" name="submit" type="image"></a><br>															</p></td>						</tr>									</tbody></table>			</td>

PHP file:

[php]<?php

////////////////////////////////////////////////////////////////

// PERFECT //

// ------- //

// PHP E-mail Receive Form Electronic Content Text //

// File: feedback.php //

// Version: 1.8 (April 21, 2008) //

// Description: Processes a web form to read the user input //

// and then send the data to a predefined recipient. You //

// are free to use and modify this script as you like. //

// Instructions: Go to “http://www.centerkey.com/php”. //

// License: Public Domain Software //

// //

// Center Key Software * www.centerkey.com * Dem Pilafian //

////////////////////////////////////////////////////////////////

// Configuration Settings

$SendFrom = “Form Feedback [email protected]”;

$SendTo = "[email protected]";

$SubjectLine = “A life quote request has arrived!”;

$ThanksURL = “http://www.nhins.com/thanks.html”; //confirmation page

// Build Message Body from Web Form Input

foreach ($_POST as $Field=>$Value)

$MsgBody .= “$Field: $Value\n”;

$MsgBody .= “\n” . @gethostbyaddr($_SERVER[“REMOTE_ADDR”]) . “\n” .

$_SERVER[“HTTP_USER_AGENT”];

$MsgBody = htmlspecialchars($MsgBody, ENT_NOQUOTES); //make safe

// Send E-Mail and Direct Browser to Confirmation Page

mail($SendTo, $SubjectLine, $MsgBody, “From: $SendFrom”);

header(“Location: $ThanksURL”);

?>[/php]

Well, what is your question? The emails are not working? You showed a form and some email code.
What have you debugged so far? You can place a “DIE” command inside your email code and test it
to see what you have for data. This would tell you if you are getting to that point or not.

So, something like die(“got here…” . $_POST[‘phone’]); would kill the email code and display the phone number. In this way, you can tell where the code is dying. I would suggest debugging this way to start and then tell us the area that you are having an issue with.

Hope that helps some…

Sponsor our Newsletter | Privacy Policy | Terms of Service