Jump to content

php problem


vettenut

Recommended Posts

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

 

<?php

 

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

 

$youremail = "acdelco40108@yahoo.com"; /*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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.