Solved

php: new line

Posted on 2004-08-10
6
169 Views
Last Modified: 2008-03-06
This code is located on the confirm page which is fine but the next page is the reply.php page and the output of this is outputed in a email form and when it display the values, it's showing the tags "<br>".
How can i not show the tags but i still need the new line or break.
this is the code i'm using:
*********************
 <TD width="300" wrap="PHYSICAL" bgcolor="#eeeeee">
<?
    $equipmentlist = stripslashes($equipmentlist);
    $equipmentlist = htmlspecialchars($equipmentlist);
    $equipmentlist = nl2br($equipmentlist);
    echo $equipmentlist;
?>
</td>
*****************************
this is the output as you can see the "<br> tags"
*******************************
asdf asdf asdf asdf asdf asdf <br />
<br />
asdf asdf
****************
0
Comment
Question by:imaw
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:TheClickMaster
ID: 11766397
You could try to replace all the <br /> with \n before displaying it on the reply.php page

str_replace("\n", "<br />",  $equipmentlist);
0
 
LVL 5

Accepted Solution

by:
TheClickMaster earned 500 total points
ID: 11766407
Oups, wrong order...

str_replace("<br />", "\n", $equipmentlist);
0
 

Author Comment

by:imaw
ID: 11766473
on the reply page, it is spitting out html i think so i'm not sure how. where do i put this code?
this is what i have on reply.php page:
**************************
$mailbody .= "IS Equipment which Requires Moving:" ."\n" . $equipmentlist . "\n";
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 36

Expert Comment

by:Zyloch
ID: 11766549
Hi

Just make sure you put the code before you echo $equipmentlist.

By the way, are you echoing $mailbody or $equipmentlist?

Regards,
Zyloch
0
 

Author Comment

by:imaw
ID: 11766575
This did the trick:
 echo nl2br(htmlspecialchars(stripslashes($comments)));

this keeps it pure.
0
 
LVL 5

Expert Comment

by:TheClickMaster
ID: 11768197
pure is good :)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now