CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   PHP echo Help (http://www.codingforums.com/showthread.php?t=283742)

hudbarnett 12-07-2012 12:58 PM

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

sunfighter 12-07-2012 06:35 PM

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);
}
?>


davidjones1990 12-07-2012 07:22 PM

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.


All times are GMT +1. The time now is 03:40 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.