shawnm Posted September 4, 2008 Share Posted September 4, 2008 Hey Everyone, I was hoping someone could help me out with a little PHP problem. Like many posters, I'm new to the PHP game. What I'm trying to accomplish is to gather information on 3 different forms spread across 3 pages, then process all of the info together and send it as an email to my email address. What I've done so far is linked the 3 pages, making the action on form1 to post to page2.php, etc. On the second and third pages (containing the second and third forms) I've included the following code: session_start(); if(!$_SESSION['ses_request']){$_SESSION['ses_request'] = $_REQUEST;}else{$_SESSION['ses_request'] = array_merge($_SESSION['ses_request'],$_REQUEST);} My submit button on the third form is set to POST to sendmail.php. I've copied the code in the sendmail.php file below: <? $ForwardTo="myemail@hotmail.com"; $card=$_REQUEST['cardbutton']; $myclue=$_REQUEST['myclue']; $mymessage=$_REQUEST['mymessage']; $name=$_REQUEST['name']; $address1=$_REQUEST['address1']; $address2=$_REQUEST['address2']; $address3=$_REQUEST['address3']; $city=$_REQUEST['city']; $state=$_REQUEST['state']; $zipcode=$_REQUEST['zipcode']; mail($ForwardTo, "New Order from $name",$card, $myclue, $mymessage, $name, $address1, $address2, $address3, $city, $state, $zipcode); header("Location: ThankYou.html"); ?> When I go to the site and fill out the form everything seems to work fine. The Thank You page even comes up fine, but I don't receive an email with the info. Cah anybody help with this?? Thank you in advance. Shawn Quote Link to comment Share on other sites More sharing options...
drisate Posted September 4, 2008 Share Posted September 4, 2008 your mail has to muc stuff the normal fountion is used this way <?php $Name = "Da Duder"; //senders name $email = "email@adress.com"; //senders e-mail adress $recipient = "PersonWhoGetsIt@emailadress.com"; //recipient $mail_body = "The text for the mail..."; //mail body $subject = "Subject for reviever"; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $mail_body, $header); //mail ?> Quote Link to comment Share on other sites More sharing options...
shawnm Posted September 4, 2008 Author Share Posted September 4, 2008 Ah I see. How can I fix this? Quote Link to comment Share on other sites More sharing options...
shawnm Posted September 4, 2008 Author Share Posted September 4, 2008 Ok so I tried combining some variables as follows but it still doesn't work: <? $ForwardTo="myemail@hotmail.com"; $card=$_REQUEST['cardbutton']; $myclue=$_REQUEST['myclue']; $mymessage=$_REQUEST['mymessage']; $name=$_REQUEST['name']; $address1=$_REQUEST['address1']; $address2=$_REQUEST['address2']; $address3=$_REQUEST['address3']; $city=$_REQUEST['city']; $state=$_REQUEST['state']; $zipcode=$_REQUEST['zipcode']; $subject = "New order for $name"; $mailmessage = "$card $myclue $mymessage $name $address1 $address2 $address3 $city $state $zipcode"; mail($ForwardTo, $subject, $mailmessage); header("Location: ThankYou.html"); ?> Any suggestions??? Thanks Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 4, 2008 Share Posted September 4, 2008 the fact that you are not receiving the email may not be an issue with PHP code, but an issue of whether your host supports this functionality and/or whether the message is being tagged as spam and stopped. for testing, i suggest that you try something besides a hotmail account. also: mail($ForwardTo, $subject, $mailmessage) or die("mail failed."); Quote Link to comment Share on other sites More sharing options...
shawnm Posted September 4, 2008 Author Share Posted September 4, 2008 I've checked with my hosting company and everything is fine there. They think there has to be something wrong with my code. Can anybody help? thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.