This is my first time making such a form and I'm having a bit of trouble.
First of all here's my HTML:
<form name="form1" method="post" action="redeem_process.php">
<label></label>
<label>First Name:
<input name="fname" type="text" id="fname" />
</label>
<label> Last Name:
<input name="lname" type="text" id="lname" />
</label>
<br />
<br />
<label>Email:
<input name="email" type="text" id="email" />
</label>
<label> Selected Prize:
<input name="prize" type="hidden" id="prize" value="<?php echo $_GET[ 'prize' ] ?>" size="50" />
</label>
<br />
<br />
<label>Address line 1:
<input name="addy1" type="text" id="addy1" size="50" />
</label>
<br />
<br />
<label>Address line 2:
<input name="addy2" type="text" id="addy2" size="50" />
</label>
<br />
<br />
<label>City:
<input name="city" type="text" id="city" />
</label>
<label> State/Province:
<input name="stateprov" type="text" id="stateprov" />
</label>
<label> Zip/Postal Code:
<input name="zip" type="text" id="zip" />
</label>
<br />
<br />
<font color="red">Please make sure the above information is correct before proceeding.</font>
<br />
<br />
<input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset">
</form>
and Here's my PHP:
<?php
$subject ="User has redeemed - domain.com";
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$prize = $_POST['prize'];
$addy1 = $_POST['addy1'];
$addy2 = $_POST['addy2'];
$city = $_POST['city'];
$stateprov = $_POST['stateprov'];
$zip = $_POST['zip'];
$message='Name: ' . $fname . ' ' . $lname . "\n" . 'Email: ' . $email . "\n" . 'Selected Prize: ' . $prize . "\n" . 'Address line 1: ' . $addy1 . "\n" . 'Address line 2: ' . $addy2 . "\n" . 'City: ' . $city . "\n" . 'State/Province: ' . $stateprov . "\n" . 'Zip/Postal Code: ' . $zip . ' ';
$from="[email protected]";
$to ='[email protected]';
$send_contact=mail($from,$to,$subject,
$message,$header);
if($send_contact){
echo "Sucess!";
}
else {
echo "ERROR";
}
?>
there's a couple problems.
Here's what the email looks like:
http://screencast.com/t/7R9ldAXby64
As you can see, First name, Last name, and email are all missing from the email, this really confuses me because this shouldn't be happening. and the other problem is, my email shows it as [email protected] instead of the email I specified.
can anyone help :S
Copyright © 2024 QUIZLS.COM - All rights reserved.
Answers & Comments
Verified answer
mail() only takes 4 parameters:
mail($to,$subject,$message,$headers);
Your code includes a $from, and that must be put into the headers. Also, your code sends headers using an undeclared variable, $header, where your variable $headers is declared.
Try replacing your mail code with: mail($to, $subject, $message, $headers . "\r\nFrom: {$from}")
Have you tried changing it to mail($to, $subject, $message, $header . "\r\nFrom: {$from}")