944,154 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 200447
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Jun 6th, 2007
0

How to insert new line character

Expand Post »
<?php
printf("This is the first line. \n");
printf("This is the second line");
?>

This is the code but it isnt printing in new line.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mithesh is offline Offline
13 posts
since Mar 2006
Jun 6th, 2007
0

Re: How to insert new line character

What you need to do is use the <br> HTML tag before each newline character. HTML doesn't accept newlines.
So, for example :

CODE
echo "this should be <br><br> a new line here <br> and here, too";

You won't need to do the carriage return for a new line in the page.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
jac39 is offline Offline
3 posts
since Apr 2007
Jun 6th, 2007
0

Re: How to insert new line character

you can make carriage returns work. HOWEVER you have to use I beileve is the pre tag. And that is kinda of messy at times. You're better off using a br tag.

just keeping options open.
Reputation Points: 10
Solved Threads: 3
Light Poster
DGStudios is offline Offline
31 posts
since Mar 2006
Oct 22nd, 2007
0

Re: How to insert new line character

tanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ali_mma is offline Offline
1 posts
since Oct 2007
Dec 21st, 2010
0
Re: How to insert new line character
%0A
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bearcatFulton is offline Offline
4 posts
since Dec 2010
Apr 7th, 2011
0
Re: How to insert new line character
this should be like this
printf("this is first line /n this is second line ")
Reputation Points: 10
Solved Threads: 0
Newbie Poster
piyushrock320 is offline Offline
1 posts
since Apr 2011
May 6th, 2011
0
Re: How to insert new line character
Hi... friends.. I have a problem with displaying popup message box. I would like to display a popup box including php values. For example my view is..

echo "<script>alert('...some text...'+'php value'+'..some text...')</script>";

I think you understand my problem. i tried alot but i didn't get. So, plz. help me in this one... thank you...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sundeep_g is offline Offline
13 posts
since Oct 2010
May 6th, 2011
0
Re: How to insert new line character
Please do not hijack old threads. But as as answer to your problem, do not use + use '.' (dot). For example,
PHP Syntax (Toggle Plain Text)
  1. echo "<script>alert('text".$varName."')</script>"
  2. //OR
  3. echo "<script>alert('text {$varName} ')</script>"
If you have further doubts please start a new thread.
Reputation Points: 28
Solved Threads: 37
Junior Poster
kekkaishi is offline Offline
164 posts
since Oct 2009
Sep 8th, 2011
0
Re: How to insert new line character
<?php
echo "This is First Line";
?>
<br>
<?php
echo "This is second line";
?>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
TheOdyssey is offline Offline
3 posts
since Sep 2011
Sep 8th, 2011
0
Re: How to insert new line character
<?php
echo "This is First line " , "<br>" , "This is second line ";
?>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
TheOdyssey is offline Offline
3 posts
since Sep 2011

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Start and stop in youtube video?
Next Thread in PHP Forum Timeline: php record search from database





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC