Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: PHP echo Help

  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP echo Help

    Hi there

    I have been using a feedback form which i found posted in these forums, it has helped me out alot as i'm new to PHP.

    My question is:

    When someone completes the form and presses submit, it will email the admin and also send a copy of the email to the sender.

    In the email it lists all of the fields completed on the form, i would like these fields to be in a table format.

    Can anyone help?

    All of the code is listed on this page:

    http://www.codingforums.com/showthre...=223549&page=2

    Thanks in advance

    Hudbarnett

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,303
    Thanks
    23
    Thanked 612 Times in 611 Posts
    I think you mean, put each on separate line. Doing a table is just the same thing unless you have header you want to inclose or something else you want to add.
    Anyway, in a email you use /n or /r/n instead of a <br> to force a linefeed. You want something like this:
    PHP Code:
     <?php
    if(isset($_POST["copy"]) && $_POST["copy"] == 1)
    {
    $mailTo htmlspecialchars($_POST['Email']);
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']);
    $telefon htmlspecialchars($_POST['Telefon']);
    $adresse htmlspecialchars($_POST['Adresse']);
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']);
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message ='Navn: '.$name.' \n
    E-post: '
    .$mailFrom.' \n
    Telefon: '
    .$telefon.' \n
    Adresse: '
    .$adresse.' \n
    Melding: '
    .$message_text.' \n';

    mail($mailTo$subject$message$header);
    }
    ?>

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    63
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Hi,

    You can use html in email view. You just need to change the content type header to text/html instead of text/plain. That was if you really want you can use a standard html table.


  •  

    Posting Permissions

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