/    Sign up×
Community /Pin to ProfileBookmark

friends i have a problem on mail function…..

hii

i am trying to send mail using php. i have to mail the values selected on selectorder.php and mail that values in ordercomplete.php for that i stored all those values in session variables in selectorder.php and using those variables i’m trying to sena mail in ordercomplete.php, mail is coming but selected values are not adding to that mail and string values are adding to thet mail. but echoing that message variable i’m getting those values… please let me know where i did a mistake….

[B]here is my code for sending mail[/B]
<?php
$yourcomments=$_SESSION[“yourcomments”];
$name=$_
SESSION[“name”];
$email=$_SESSION[“email”];
$addressLine1=$_
SESSION[“addressLine1”];
$addressLine2=$_SESSION[“addressLine2”];
$city_state_zip=$_
SESSION[“city_state_zip”];
$phone=$_SESSION[“phone”];
$to=”[email protected],”.$email;
$subject =”Feedback”;
$othermusicGenre=$_
SESSION[“othermusicgenre”];
$otheremotions=$_SESSION[“otherEmotions”];
$othersoundEffects=$_
SESSION[“othersoundEffects”];
$otherinstruments=$_SESSION[“otherinstruments”];
$othervocals=$_
SESSION[“beatMenu”];
$beatmenu=$_SESSION[“othervocals”];
$message1=”rn”.$name.”selected rn”;
$message2=”MusicGenre:”;
if(sizeof($_
SESSION[“musicgenre”])!=0)
{
$message3=””;
foreach ($_SESSION[“musicgenre”] as $MG)
{
$message3 .=$MG.”,”;
}
}
$message4=”OtherMusicGenre:”.$othermusicGenre;
$message5=”Emotions Menu:”;
if(sizeof($_
SESSION[“emotions”])!=0)
{
$message6=””;
foreach ($_SESSION[“emotions”] as $EM)
{
$message6 .=$EM.”,”;
}
}
$message7=”OtherEmotions:”.$otheremotions;
$message8=”Sound Effects Menu:”;
if(sizeof($_
SESSION[“soundeffects”])!=0)
{
$message9=””;
foreach ($_SESSION[“soundeffects”] as $SE)
{
$message9 .=$SE.”,”;
}
}
$mess1=”OtherSoundEffects:”.$othersoundEffects;
$mess2=”Instruments Menu::”;
if(sizeof($_
SESSION[“instruments”])!=0)
{
$mess3=””;
foreach ($_SESSION[“instruments”] as $IM)
{
$mess3 .=$IM.”,”;
}
}
$mess4=”OtherInstruments:”.$otherinstruments;
$mess5=”BeatMenu:”.$beatmenu;
$mess6=”Vocals Menu:”;
if(sizeof($_
SESSION[“vocals”])!=0)
{
$mess7=””;
foreach ($_SESSION[“vocals”] as $VC)
{
$mess7 .=$VC.”,”;
}
}
$mess8=”OtherVocals:”.$othervocals;
$message=”rn”.$message1.”rn”.$message2.$message3.”rn”.$message4.”rn”.$message5.$message6.”rn”.$message7.”rn”.$message8.$message9.”rn”.$mess1.”rn”.$mess2.$mess3.”rn”.$mess4.”rn”.$mess5.”rn”.$mess6.$mess7.”rn”.$mess8.”rnr Name:”.$name.”rn Mailid:”.$email.”rn Address:”.$addressLine1.”rn”.$addressLine2.”rn City/State/Zip:”.$city_state_zip.”rn Phone Number:”.$phone.”rn Comment:”.$yourcomments;
$message = wordwrap($message, 70, “rn”);
mail($to, $subject, $message);
?>

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@speghettiCodeJan 11.2013 — Don't forget to add session_start(); to the top of this script. Otherwise, I'm not even sure how you're able to access any of the session variables.

For clarity, could you include selectorder.php and ordercomplete.php? Also, could you explain exactly which fields are displaying as expected?
×

Success!

Help @ramyasri spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...