www.webdeveloper.com
Results 1 to 2 of 2

Thread: friends i have a problem on mail function.....

Hybrid View

  1. #1
    Join Date
    Nov 2012
    Posts
    20

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

    here is my code for sending mail
    <?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="naveenyadav28@gmail.com,".$email;
    $subject ="Feedback";
    $othermusicGenre=$_SESSION["othermusicgenre"];
    $otheremotions=$_SESSION["otherEmotions"];
    $othersoundEffects=$_SESSION["othersoundEffects"];
    $otherinstruments=$_SESSION["otherinstruments"];
    $othervocals=$_SESSION["beatMenu"];
    $beatmenu=$_SESSION["othervocals"];
    $message1="\r\n".$name."selected \r\n";
    $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="\r\n".$message1."\r\n".$message2.$message3."\r\n".$message4."\r\n".$message5.$message6."\r \n".$message7."\r\n".$message8.$message9."\r\n".$mess1."\r\n".$mess2.$mess3."\r\n".$mess4."\r\n".$me ss5."\r\n".$mess6.$mess7."\r\n".$mess8."\r\n\r Name:".$name."\r\n Mailid:".$email."\r\n Address:".$addressLine1."\r\n".$addressLine2."\r\n City/State/Zip:".$city_state_zip."\r\n Phone Number:".$phone."\r\n Comment:".$yourcomments;
    $message = wordwrap($message, 70, "\r\n");
    mail($to, $subject, $message);
    ?>

  2. #2
    Join Date
    Sep 2008
    Posts
    95
    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?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles