Jump to content

php session and mailto help!


shawnm

Recommended Posts

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="[email protected]";

$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

 

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/122774-php-session-and-mailto-help/
Share on other sites

your mail has to muc stuff the normal fountion is used this way

 

<?php

 

$Name = "Da Duder"; //senders name

$email = "[email protected]"; //senders e-mail adress

$recipient = "[email protected]"; //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

?>

Ok so I tried combining some variables as follows but it still doesn't work:

 

<?

$ForwardTo="[email protected]";

$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

 

 

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.");

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.