Jump to content

php problem


vettenut

Recommended Posts

I do not receive email for my published php file which is:

 

<?php

 

///// easend.php /////

 

$youremail = "[email protected]"; /*put the email address here, between quotes,

the email address you want the message sent to*/

 

$to = $youremail;

$email = $_POST['EMail'];

$name2 = $_POST['Name'];

$street2 = $_POST['Street'];

$city2 = $_POST['City'];

$state2 = $_POST['State'];

$zip2 = $_POST['Zip'];

$Phone = $_POST['Home_Phone'];

$Cell = $_POST['Cell_Phone'];

$education = $_POST['email1'];

$comments = $_POST['email2'] ;

 

$headers = "From:" . $email;

 

$fields = array();

$fields{"Name"} = "Name";

$fields{"Street"} = "Street";

$fields{"City"} = "City";

$fields{"State"} = "State";

$fields{"Zip"} = "Zip";

$fields{"Home_Phone"} = "Home Phone";

$fields{"Cell_Phone"} = "Cell Phone";

$fields{"EMail"} = "Email";

$fields{"email1"} = "Education";

$fields{"email2"} = "Comments";

 

$subject = "We have received the following information from your employment application";

$body = "We have received the following information from your employment application:\n\n"; foreach($fields as $a => $b)

{ $body .= sprintf("%20s: %s\n",$b,$_POST[$a]); }

 

mail ($to, $subject, $body, $headers); //send mail to owner

#end create email vars

 

$headers = "From:" . $to;

 

mail ($email, $subject, $body, $headers); //send mail to user

#end create email vars

 

echo "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"2;

URL=ThankYou.html\"></head>";

 

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/251850-php-problem/
Share on other sites

Hi

 

First of all, in PHP, you do arrays like this:

$fields['Name']="$var or string";

 

Second, you need to send headers with your mail.

Look here:

http://www.w3schools.com/php/func_mail_mail.asp

 

Although I've never been able to find it documented in the manual, curly braces do seem to work to enclose array indices.

Link to comment
https://forums.phpfreaks.com/topic/251850-php-problem/#findComment-1291398
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.