Solved

php: new line

Posted on 2004-08-10
6
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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 count occurrences of each item in an array.
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 …

717 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