Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

<br/> in PHP

Featured Replies

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???

Yes, it can be used in php. But you should echo it like this:

 

<php

echo "<br />";

?>

  • Author

So basically it would look like :-

 

$msg = "Email: ".$useraddr." echo "<br />"; Phone Number: ".$phonenum."

 

 

is that right??

So basically it would look like :-

 

$msg = "Email: ".$useraddr." echo "<br />"; Phone Number: ".$phonenum."

 

 

is that right??

 

Correct.

  • Author

Nope that don't work

 

echo "<br />";

 

it's causing a syntax error....

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.

  • 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;

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

  • Author

F A N T A S T I C

 

Just what I was after cheers

For future reference, you shouldn't use <br /> in emails. It's better to use \n

\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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.