Solved

php: new line

Posted on 2004-08-10
6
172 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP not parsing ' character 12 46
Currency in SQL? 2 30
Split wordpress loop 35 56
SQL querys that gives me from one table into another. 2 23
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

809 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