October 18, 200817 yr Hi All, I'm wishing to know if the <br/> can be used in PHP....?? heres the line i want to know about $msg = "Email: ".$useraddr." *can a line break go hear* Phone Number: ".$phonenum." *and hear* Message: ".$comments." * and hear* Name: ".$username; $headers = "From: $useraddr \r\n"; mail($to, $re, $msg, $headers); echo("<h1 class=\"hd\">Message Sent</h1>Thank you $username for your request, we will be in touch shortly."); } if so what should i use???
October 18, 200817 yr Yes, it can be used in php. But you should echo it like this: <php echo "<br />"; ?>
October 18, 200817 yr Author So basically it would look like :- $msg = "Email: ".$useraddr." echo "<br />"; Phone Number: ".$phonenum." is that right??
October 18, 200817 yr So basically it would look like :- $msg = "Email: ".$useraddr." echo "<br />"; Phone Number: ".$phonenum." is that right?? Correct.
October 18, 200817 yr So basically it would look like :- $msg = "Email: ".$useraddr." echo "<br />"; Phone Number: ".$phonenum." is that right?? Nope... Sorry that's wrong: It's just: $msg = "Email: ".$useraddr."<br /> Phone Number: ".$phonenum." In PHP plain text (i.e. "Email" ) and html tags can be combined in strings and once you print the variable you've stored it in ($msg) the browser will parse the html.
October 18, 200817 yr Author this is the line that goes to the email and I basically want to do a line break between each one so when the email comes through it looks like this: Name: Customer Name Email: domain@domain.com Tel: 0987654321 Message: The customer message.... As a pose to what it does now: Name: Customer Name Phone Number: 07500045825 Message: This is a test email Email: domain@domain.com Here's the actualy line of code: $msg = "Name: ".$username." Phone Number: ".$phonenum." Message: ".$comments." Email: ".$useraddr;
October 18, 200817 yr Hi is this what your after no <br> needed $messagesent=("you have recived a message from $name Email {$email} Tel {$tel} Phone back at {$callback} Message {$message}"); the recived email will have the breaks already added and each field will be on it own line
October 19, 200817 yr For future reference, you shouldn't use <br /> in emails. It's better to use \n
October 19, 200817 yr \n and \r there are two different types of line breaks I think the ascii for a caridge return is around 32 and a hard return 34 (i think) and the equiv in php is \n and for a hard return \n\r
Create an account or sign in to comment