SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    Once I was a Factory Worker goofy's Avatar
    Join Date
    Dec 2004
    Location
    Sydney Australia
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    text format in email using php

    I want to output the text fields used in a form submission to email back to me. How do I write the code so that I can have each variable on a new line in the email.

    PHP Code:
    $to "myemail.com";
        
    $subject "Your email has been sent";
        
    $body "Fullname: ".$fullname1//this works
                
    "Best Contact Number: ".$contactNumber1//this doesn't
        
    if (mail($to,$subject,$body)){
            echo 
    "<b>Your email has been sent your email</b>";
        } 
    Goofy
    Life is what you make it!
    Follow your dreams!

  2. #2
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm...Not sure what your wanting...

    But I think if you use a simple <html> <br> in there it will seperate the two.

    echo'<br>';

    I think that's what your asking.

  3. #3
    Once I was a Factory Worker goofy's Avatar
    Join Date
    Dec 2004
    Location
    Sydney Australia
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just want it to say in the email

    Fullname: $variable value
    Best Contact Number: 555 5555 5555
    etc
    etc
    etc
    Goofy
    Life is what you make it!
    Follow your dreams!

  4. #4
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yah...you need the echo '<br>'; in there.

  5. #5
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    294
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
     $to "myemail.com";
        
    $subject "Your email has been sent";
        
    $body "Fullname: ".$fullname1
    echo 
    '<br>';
                
    "Best Contact Number: ".$contactNumber1//this doesn't
        
    if (mail($to,$subject,$body)){
            echo 
    "<b>Your email has been sent your email</b>";
        } 

  6. #6
    Once I was a Factory Worker goofy's Avatar
    Join Date
    Dec 2004
    Location
    Sydney Australia
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    where does it go? on the next line? and do I need ; at the end of each line?
    Goofy
    Life is what you make it!
    Follow your dreams!

  7. #7
    Once I was a Factory Worker goofy's Avatar
    Join Date
    Dec 2004
    Location
    Sydney Australia
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i'll give that a go
    Goofy
    Life is what you make it!
    Follow your dreams!

  8. #8
    Once I was a Factory Worker goofy's Avatar
    Join Date
    Dec 2004
    Location
    Sydney Australia
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The second variable line doesn't show up in the email only the first line. Got any idea why?
    Goofy
    Life is what you make it!
    Follow your dreams!

  9. #9
    Once I was a Factory Worker goofy's Avatar
    Join Date
    Dec 2004
    Location
    Sydney Australia
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is what worked

    PHP Code:
    $to "myemail.com";
        
    $subject "Your email has been sent";
        
    $body "Fullname: " $fullname1 "\n\n" "Best Contact Number: " $contactNumber1//this works
        
    if (mail($to,$subject,$body)){
            echo 
    "<b>Your email has been sent your email</b>";
        } 
    Last edited by goofy; Oct 12, 2005 at 22:53. Reason: typo
    Goofy
    Life is what you make it!
    Follow your dreams!


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
  •