Hi,
I am working on a page where you fill out a form to sign up for an email newsletter. Sending an email alone is no problem, but the text entered into the form does not show up when I run a test.
I know it probably has to do with how the info is being posted, but I haven't the slightest clue what code is missing/incorrect.
All I'm trying to do is have the information entered into the form be in the body of the email the PHP sends out.
Here's the form page: http://www.laurendragon.com/mailinglistform.php
The code I'm using:
Here is the sendemail.php code:PHP Code:<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<form method="POST" action="sendemail.PHP" name="mailinglist" id="mailinglist">
<div align="left">
<p align="center"><br>
Name (First & Last):<br>
<input type="text" name="Name"/>
<br>
<br>
City:<br>
<input type="text" name="City" />
<br>
<br>
State:<br>
<input type="text" name="State"/>
<br>
<br>
Email:<br>
<input type="text" name="Email"/>
<br>
<br>
<input type="submit" VALUE="Sign Me Up" onClick="alert('Thank you! Your form has been sent.')" />
<br>
</p>
</div>
</form>
</form>
I tried to change the code to a post array:PHP Code:<?php
$to="Laurendragon@laurendragon.net";
$subject="Mailing List Signup";
$body="
Name $name
City $city
State $state
Email $email";
mail($to,$subject,$body);
?>
I got this error message:PHP Code:$body="
Name $_POST['name']
City $_POST['city']
State $_POST['state']
Email $_POST['email']";
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in sendemail.php on line 15
Line 15 when I look at it in Dreamweaver MX is Name $_POST['name']
Any help is much appreciated.
-Raven




Reply With Quote



Bookmarks