Jump to content
Server Maintenance This Week. ×

losing carriage returns in text field


This topic is 3975 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
I am wanting to show contact info for a family.  The output I get is putting everything on one line.  It is ignoring the carriage returns.  My field in my database is a calculated field with carriage returns after certain info. See below for how I want the output to look.
 
I am displaying the data in a table.  This is the line where I call the getField function.
 
$table3_data .=  $related_record->getField('HOH Info::DirectoryCombinedText');
 
 
 
Output looks like:
Parent1 Name & Parent2 Name Children: Child1, Child2, etc Address City, State Zip (h) (111)111-1111 Parent1 Name (111)111-1111 Parent2 (111)111-1111 Parent2 Name - [email protected] Parent2 Name - [email protected]
 
What I want output to look like:

Parent1 Name & Parent 2 Name

Children: Child1 Name, Child2 Name,etc

Address

City, State, Zip

(h) (111) 111-1111

Parent1 Name (111) 111-1111

Parent2 Name (111) 111-1111

Parent1 Name - [email protected]

Parent2 Name - [email protected]

Link to comment
Share on other sites

It's a standard php function to turn carriage returns and new lines into something that web browsers understand...

 

nl2br($field) will take

 

data

data

 

and make it

 

data<br>data

 

Which will then be shown in a browser as

 

data

data

Link to comment
Share on other sites

This topic is 3975 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.