PHP echo Help
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:
Thanks in advance
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:
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);
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.