Jump to content

Recommended Posts

Hi i need help on adding a space between each word for example

 

Fist Name: PHP

 

Second name: Code

 

Phone Number: 123456789

 

Subject: PHP

 

Message: HELP!!!

 

what i get is

 

Fist Name: PHP <p> </p>  Second name: Code Phone Number: 123456789 Subject: PHP Message: HELP!!!

 

the codes below can anyone help

 

Thanks

 

<?php

 

$email =$_REQUEST['email'];

$firstname = $_REQUEST['firstname'];

$secondname =$_REQUEST['secondname'];

$phonenumber =$_REQUEST['phonenumber'];

$subject = $_REQUEST['subject'];

$comment =$_REQUEST['comment'];   

     

//email address mess is sent to    subject of email

mail ( "myemail@hotmail.com" ,"Email From Customer",

"Fist Name: $firstname <p> </p>  Second name: $secondname Phone Number: $phonenumber Subject: $subject Message: $comment",

      "From: $firstname $secondname At: $email" );

header ( "Location: thanks.html" );

 

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/66132-php-mail/
Share on other sites

Hi.

 

The reason you are getting this as an output is that you have not specified the content type as HTML in the mail() function.

 

You can do this like this:

 

$body = "<HTML><HEAD></HEAD><BODY><STRONG>HELLO</STRONG><P>THIS IS A TEST</P><BR><BR>A NEW LINE</BODY></HTML>";

 

mail("EMAILTO", "SUBJECT", $body, "From: FROM NAME <EMAIL@ADDRESS.COM> \nContent-Type: text/html; charset=iso-8859-1");

 

Hope this helps....

James

Link to comment
https://forums.phpfreaks.com/topic/66132-php-mail/#findComment-330790
Share on other sites

i get this message now its because of the header is there another way to display the thanks.html page

 

Warning: Cannot modify header information - headers already sent by (output started at /home/content/n/e/w/newman100/html/brentwoodcomputerrepairs/brentwoodcomputerrepairs/sendmail.php:2) in /home/content/n/e/w/newman100/html/brentwoodcomputerrepairs/brentwoodcomputerrepairs/sendmail.php on line 16

 

current code

 

<html>

<?php

 

$email =$_REQUEST['email'];

$firstname = $_REQUEST['firstname'];

$secondname =$_REQUEST['secondname'];

$phonenumber =$_REQUEST['phonenumber'];

$subject = $_REQUEST['subject'];

$comment =$_REQUEST['comment'];

 

     

//email address mess is sent to    subject of email

mail ( "mortalsombat@hotmail.com" ,"Email From Customer",

"Fist Name: $firstname <p> Second name: $secondname <p> Phone Number: $phonenumber <p> Subject: $subject <p> Message: $comment",

      "From: $firstname $secondname At: $email \nContent-Type: text/html; charset=iso-8859-1");

header ( "Location: thanks.html" );

 

?>

 

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/66132-php-mail/#findComment-330881
Share on other sites

like this?

 

<?php ob_start();?>

 

<html>

 

$email =$_REQUEST['email'];

$firstname = $_REQUEST['firstname'];

$secondname =$_REQUEST['secondname'];

$phonenumber =$_REQUEST['phonenumber'];

$subject = $_REQUEST['subject'];

$comment =$_REQUEST['comment'];

 

     

//email address mess is sent to    subject of email

mail ( "mortalsombat@hotmail.com" ,"Email From Customer",

"Fist Name: $firstname <p> Second name: $secondname <p> Phone Number: $phonenumber <p> Subject: $subject <p> Message: $comment",

      "From: $firstname $secondname At: $email \nContent-Type: text/html; charset=iso-8859-1");

header ( "Location: thanks.html" );

 

?>

 

</html>

 

<? ob_end_flush();?>

Link to comment
https://forums.phpfreaks.com/topic/66132-php-mail/#findComment-330901
Share on other sites

This code does not work when i load it into dreamweaver this code:

 

$email =$_REQUEST['email'];

$firstname = $_REQUEST['firstname'];

$secondname =$_REQUEST['secondname'];

$phonenumber =$_REQUEST['phonenumber'];

$subject = $_REQUEST['subject'];

$comment =$_REQUEST['comment'];

 

     

//email address mess is sent to    subject of email

mail ( "mortalsombat@hotmail.com" ,"Email From Customer",

"Fist Name: $firstname <p> Second name: $secondname <p> Phone Number: $phonenumber <p> Subject: $subject <p> Message: $comment",

      "From: $firstname $secondname At: $email \nContent-Type: text/html; charset=iso-8859-1");

header ( "Location: thanks.html" );

 

is all black indicating that its showing as text not php code what have i done wrong

 

Regards shenmue232

Link to comment
https://forums.phpfreaks.com/topic/66132-php-mail/#findComment-331703
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.