SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    Australia
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Email message after submit

    When you fill out the form and click submit to send email then you'll get preview message, like:

    Your message has been sent to boo@boo.com .
    Here's the preview message:

    Name: blah
    Email: blah@blah.com
    Subject: blah
    Comment: text text text

    Is it correct? [SEND NOW!]


    Do you know whats the code for the message preview?

    Hope you get it

    Thanks.
    Tribolis.com Affordable Web Hosting Solutions since 2004
    Comes with Fantastico Auto Installer & Daily Backup!
    WeLoveCSS.com XHTML & CSS Forum for everyone

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for easy you can go throught POST array and print the contents
    Your message has been sent to boo@boo.com .
    Here's the preview message:
    PHP Code:
    $cfg = array('submit'=>1);
    $msg 'Your message has been sent to '.$recipient.'<br>';
    $msg .= 'Here\'s your preview message.<br>';
    foreach(
    $_POST as $key=>$value)
    {
     if(!isset(
    $cfg[$key]))
     {
       
    $msg .= $key.': '.$value.'<br>';
     }
    }
    echo 
    $msg
    $cfg is an array for the fields which you DONT WANT TO SHOW in preview.

    remeber there might be things like mutiple selects and checkboxes. in that case you have to check if the $value is array if yes then loop through that. the solution for that situation might be recursive function.

    hope this helps

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    Australia
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    if (isset($_POST['submit'])) {
      
     
    $name stripslashes(trim($_POST['name'])); 
    // and so on...

     
    if (empty($_POST['name'])) // and so on { 
        
    echo "<b>blah</b><br>"
    Your code, I don't know where I can put. Can you please tell me where to put in array? I wasn't sure, I am not a php expert.

    Thanks
    Tribolis.com Affordable Web Hosting Solutions since 2004
    Comes with Fantastico Auto Installer & Daily Backup!
    WeLoveCSS.com XHTML & CSS Forum for everyone


Bookmarks

Posting Permissions

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