[PHP] Line breaks in mail function?

2005-11-06 Thread Murray @ PlanetThoughtful

Hi All,

I'm building a site on a new web host and am currently working on 
feedback forms.


I'm using the mail() function to send the feedback to the destination 
mail account, and I'm having problems getting the body of the email to 
line break.


I've tried constructing the body with both \n\n and \r\n\r\n 
terminating lines where I want line breaks to appear, but both return an 
email with the body in one long string showing the actual \n\n or 
\r\n\r\n characters, as opposed to interpreting them as line breaks.


Example code:

   $body = 'From: ' . $name . '\r\n\r\n';
   $body .= 'Email:' . $email . '\r\n\r\n';
   $body .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . '\r\n\r\n';
   $body .= 'Feedback:\r\n\r\n';
   $body .= $feedback;
   mail([EMAIL PROTECTED], Feedback, $body, From: 
$email\r\nReply-To: $email\r\nX-Mailer: PHP/ . phpversion());


As I said above, I've also tried using \n\n instead of \r\n\r\n.

Can anyone give me some advive on how to get the linebreak characters 
interpreted as linebreaks?


Many thanks and much warmth,

Murray

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Line breaks in mail function?

2005-11-06 Thread Jasper Bryant-Greene
On Mon, 2005-11-07 at 12:20 +1000, Murray @ PlanetThoughtful wrote:
 Example code:
 
 $body = 'From: ' . $name . '\r\n\r\n';
 $body .= 'Email:' . $email . '\r\n\r\n';
 $body .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . '\r\n\r\n';
 $body .= 'Feedback:\r\n\r\n';
 $body .= $feedback;
 mail([EMAIL PROTECTED], Feedback, $body, From: 
 $email\r\nReply-To: $email\r\nX-Mailer: PHP/ . phpversion());
 
 As I said above, I've also tried using \n\n instead of \r\n\r\n.
 
 Can anyone give me some advive on how to get the linebreak characters 
 interpreted as linebreaks?

Use double quotes around the parts that have \r and \n characters if you
want them to be interpreted.

-- 
Jasper Bryant-Greene
General Manager
Album Limited

e: [EMAIL PROTECTED]
w: http://www.album.co.nz/
b: http://jbg.name/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Line breaks in mail function?

2005-11-06 Thread Richard Leclair
Hi Murray,

Try doing something like this:

---
$body = From: $name
Email: $email
IP Address: $_SERVER['REMOTE_ADDR']

Feedback:

$feedback
;

$fromaddr = $email
Reply-To: $email
X-Mailer: PHP/ . phpversion();

mail([EMAIL PROTECTED], Feedback, $body, $fromaddr);
---

I haven't tested this 'actual' piece of code, but I've used similar in other
emailing scripts.

Regards,
Richie !

 -Original Message-
 From: Murray @ PlanetThoughtful [mailto:[EMAIL PROTECTED]
 Sent: Monday, 7 November 2005 10:21 am
 To: php-general@lists.php.net
 Subject: [PHP] Line breaks in mail function?
 
 Hi All,
 
 I'm building a site on a new web host and am currently working on
 feedback forms.
 
 I'm using the mail() function to send the feedback to the destination
 mail account, and I'm having problems getting the body of the email to
 line break.
 
 I've tried constructing the body with both \n\n and \r\n\r\n
 terminating lines where I want line breaks to appear, but both return an
 email with the body in one long string showing the actual \n\n or
 \r\n\r\n characters, as opposed to interpreting them as line breaks.
 
 Example code:
 
 $body = 'From: ' . $name . '\r\n\r\n';
 $body .= 'Email:' . $email . '\r\n\r\n';
 $body .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . '\r\n\r\n';
 $body .= 'Feedback:\r\n\r\n';
 $body .= $feedback;
 mail([EMAIL PROTECTED], Feedback, $body, From:
 $email\r\nReply-To: $email\r\nX-Mailer: PHP/ . phpversion());
 
 As I said above, I've also tried using \n\n instead of \r\n\r\n.
 
 Can anyone give me some advive on how to get the linebreak characters
 interpreted as linebreaks?
 
 Many thanks and much warmth,
 
 Murray
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Line breaks in mail function?

2005-11-06 Thread Murray @ PlanetThoughtful

Jasper Bryant-Greene wrote:


On Mon, 2005-11-07 at 12:20 +1000, Murray @ PlanetThoughtful wrote:
 


Example code:

   $body = 'From: ' . $name . '\r\n\r\n';
   $body .= 'Email:' . $email . '\r\n\r\n';
   $body .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . '\r\n\r\n';
   $body .= 'Feedback:\r\n\r\n';
   $body .= $feedback;
   mail([EMAIL PROTECTED], Feedback, $body, From: 
$email\r\nReply-To: $email\r\nX-Mailer: PHP/ . phpversion());


As I said above, I've also tried using \n\n instead of \r\n\r\n.

Can anyone give me some advive on how to get the linebreak characters 
interpreted as linebreaks?
   



Use double quotes around the parts that have \r and \n characters if you
want them to be interpreted.

 


Ah, damn you Jasper, I should have noticed that myself.

Don't you hate it when you've been staring at code too long to notice 
the obvious?


Thank you!

Much warmth,

Murray

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Line breaks in form

2004-11-29 Thread Chris Farrugia
Greetings,

 

On one of my forms to send email, I have multiple line breaks with different
paragraphs.  I looked up the nl2br function and that looks like an option,
but I would ideally like to wrap these paragraphs inside p/p tags.  Is
there a way to do this easily?  Any advice would be greatly appreciated.

 

Thanks,

Chris

 



Re: [PHP] Line breaks in form

2004-11-29 Thread John Nichel
Chris Farrugia wrote:
Greetings,
 

On one of my forms to send email, I have multiple line breaks with different
paragraphs.  I looked up the nl2br function and that looks like an option,
but I would ideally like to wrap these paragraphs inside p/p tags.  Is
there a way to do this easily?  Any advice would be greatly appreciated.
I'm sure somebody will have a 'cleaner' way, but...
$text = preg_split ( /\n/, $inputText );
for ( $i = 0; $i  sizeof ( $text ); $i++ ) {
if ( $text[$i] !=  ) {
$text[$i] = p . $text[$i] . /p;
}
}
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Line breaks in form

2004-11-29 Thread Greg Donald
On Mon, 29 Nov 2004 12:29:59 -0500, Chris Farrugia
[EMAIL PROTECTED] wrote:
 On one of my forms to send email, I have multiple line breaks with different
 paragraphs.  I looked up the nl2br function and that looks like an option,
 but I would ideally like to wrap these paragraphs inside p/p tags.  Is
 there a way to do this easily?  Any advice would be greatly appreciated.

explode() the text by the \n character, this will give you an array.
 Iterate over the array and add your p tags there.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] line breaks in email text messages

2004-09-13 Thread Michael Collins
How do I preserve line breaks in the body of an email message? The 
email message is plain text and I simply want to have a return 
included between each element entered into a form. I have used \n or 
\r\n (since this is a Windows server) to no avail. The email message 
I get back has all the data, but no line breaks. Any hints?

$emailbody = 'Sent by: '.$_POST['name'];
$emailbody .= \nEmail: .$email_from;
if(isset($_POST['company'])){
$emailbody .= \nCompany: .$_POST['company'];
}
if(isset($_POST['address'])){
$emailbody .= \nAddress: .$_POST['address'];
}
... etc ...
mail($email_to,$email_subject,$emailbody,$header)
--
Michael
__
||| Michael Collins
||| Kuwago Inc
||| Singapore and Seattle USA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] line breaks in email text messages

2004-09-13 Thread Michael Collins
At 9:11 AM +0800 9/14/04, Michael Collins wrote:
How do I preserve line breaks in the body of an email message?

Nevermind got it figured out. sorry for the extra bandwidth
--
Michael
__
||| Michael Collins
||| Kuwago Inc
||| Singapore and Seattle USA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Line breaks again....

2004-07-21 Thread PHP User
Hi,

I have managed to get the line breaks to show up on my site no problem, but
I still get one long line when it is sent to my email. I have looked and
looked and have read all the stuff I could find on \r\n, so I'm not sure
where to go from here since it's not working...

Suggestions are appreciated.

Thanks, Beauford


Re: [PHP] Line breaks again....

2004-07-21 Thread John W. Holmes
PHP User wrote:
I have managed to get the line breaks to show up on my site no problem, but
I still get one long line when it is sent to my email. I have looked and
looked and have read all the stuff I could find on \r\n, so I'm not sure
where to go from here since it's not working...
Are you viewing HTML email or plain text? Using \r\n or \n will work 
fine in most email viewers. Are you sure you're not stripping the \n 
from the text to show it with br in HTML and then screwing up the 
presentation in email? Hard to tell what you're doing without any 
code... hint hint...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Line breaks again....

2004-07-21 Thread PHP User
I am using Outlook 2003 in text mode to view messages (which is what I
want). This is the relevent code...

 Code for input from form .

$text=str_replace(\n,\r\n,$text);  
* this replaces \n before the email is sent. Not sure this is necessary or
right, but nothing else I have tried works either *

if($mail-Send()) * email gets sent
{

$text=str_replace(\n,br,$text); 
$text=str_replace(br /,,$text); 
* these two lines make it display properly on my site *

. Code to display message 

Thanks

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: July 21, 2004 6:36 PM
To: PHP User
Cc: PHP
Subject: Re: [PHP] Line breaks again

PHP User wrote:

 I have managed to get the line breaks to show up on my site no problem,
but
 I still get one long line when it is sent to my email. I have looked and
 looked and have read all the stuff I could find on \r\n, so I'm not sure
 where to go from here since it's not working...

Are you viewing HTML email or plain text? Using \r\n or \n will work 
fine in most email viewers. Are you sure you're not stripping the \n 
from the text to show it with br in HTML and then screwing up the 
presentation in email? Hard to tell what you're doing without any 
code... hint hint...

-- 

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Line breaks again....

2004-07-21 Thread Justin Patrin
On Wed, 21 Jul 2004 23:42:04 -0400, PHP User [EMAIL PROTECTED] wrote:
 I am using Outlook 2003 in text mode to view messages (which is what I
 want). 

AHA! Outlook, by default, removes extra line breaks in text
messages. Do you see a message which says this in Outlook? This is an
option you can turn off. If this doesn't work, just send the message
as HTML. There's really no reason not to, especially if you're in
Outlook.

 This is the relevent code...
 
  Code for input from form .
 
 $text=str_replace(\n,\r\n,$text);

I've used the following to fix newlines:

$text=str_replace(\r\n,\n,$text);
$text=str_replace(\r,\n,$text);
$text=str_replace(\n,\r\n,$text);

 * this replaces \n before the email is sent. Not sure this is necessary or
 right, but nothing else I have tried works either *
 
 if($mail-Send()) * email gets sent
 {
 
 $text=str_replace(\n,br,$text);
 $text=str_replace(br /,,$text);
 * these two lines make it display properly on my site *
 
 . Code to display message 
 
 Thanks
 
 
 
 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: July 21, 2004 6:36 PM
 To: PHP User
 Cc: PHP
 Subject: Re: [PHP] Line breaks again
 
 PHP User wrote:
 
  I have managed to get the line breaks to show up on my site no problem,
 but
  I still get one long line when it is sent to my email. I have looked and
  looked and have read all the stuff I could find on \r\n, so I'm not sure
  where to go from here since it's not working...
 
 Are you viewing HTML email or plain text? Using \r\n or \n will work
 fine in most email viewers. Are you sure you're not stripping the \n
 from the text to show it with br in HTML and then screwing up the
 presentation in email? Hard to tell what you're doing without any
 code... hint hint...
 
-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Line breaks again....

2004-07-21 Thread Jason Wong
On Thursday 22 July 2004 13:13, Justin Patrin wrote:

 AHA! Outlook, by default, removes extra line breaks in text
 messages. Do you see a message which says this in Outlook? This is an
 option you can turn off. If this doesn't work, just send the message
 as HTML. There's really no reason not to, especially if you're in
 Outlook.

Haven't used OUtlook for years - viewing the message source (Alt-ENTER ?) will 
show the message verbatim, with all newlines etc wouldn't it?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I have found little that is good about human beings.  In my experience
most of them are trash.
-- Sigmund Freud
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Line breaks in PHP.

2003-12-16 Thread Philip J. Newman
Question:

When you hit enter in a text box is that classified as a \n?

---
Philip J. Newman
Master Developer
PhilipNZ.com [NZ] Ltd.
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Line breaks in PHP.

2003-12-16 Thread Justin French
On Wednesday, December 17, 2003, at 03:10  PM, Philip J. Newman wrote:

Question:

When you hit enter in a text box is that classified as a \n?

generally, yes.

depending on the client platform, it might be an \r\n or \r (I've 
heard)...

justin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Line breaks in PHP.

2003-12-16 Thread Philip J. Newman
Ok thats cool, guess i'll look for both, and only one in the data

- Original Message - 
From: Justin French [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 5:35 PM
Subject: Re: [PHP] Line breaks in PHP.


 On Wednesday, December 17, 2003, at 03:10  PM, Philip J. Newman wrote:
 
  Question:
 
  When you hit enter in a text box is that classified as a \n?
 
 
 generally, yes.
 
 depending on the client platform, it might be an \r\n or \r (I've 
 heard)...
 
 justin
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] line breaks

2003-11-25 Thread Rodney Green
Greetings!

I'm writing a script that will take the contents of a text file that has 
several lines of user accounts and creates a shell script with chown 
commands for each user in that text file. My problem is that when it 
writes the shell script file it puts a line break after the colon in 
between $buffer and html. How do I prevent this from doing that?

Thanks,
Rod
Code:
---
$fhandle = fopen (/scripts/thescript.sh , a);
$handle = fopen (/scripts/mail_list.txt, r);
while (!feof ($handle)) {
   $buffer = fgets($handle, 1000);
  
   fwrite ($fhandle, chown $buffer:html 
/scripts/var/spool/mail/$buffer\n, 4096);
}
fclose ($handle);
fclose ($fhandle);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] line breaks

2003-11-25 Thread John Nichel
Rodney Green wrote:

Greetings!

I'm writing a script that will take the contents of a text file that has 
several lines of user accounts and creates a shell script with chown 
commands for each user in that text file. My problem is that when it 
writes the shell script file it puts a line break after the colon in 
between $buffer and html. How do I prevent this from doing that?

Thanks,
Rod
Code:
---
$fhandle = fopen (/scripts/thescript.sh , a);
$handle = fopen (/scripts/mail_list.txt, r);
while (!feof ($handle)) {
   $buffer = fgets($handle, 1000);
 fwrite ($fhandle, chown $buffer:html 
/scripts/var/spool/mail/$buffer\n, 4096);
}
fclose ($handle);
fclose ($fhandle);



Chances are, $buffer has the line break on it when you read it in from 
the text file.  Try striping off whitespace before you write...

while (!feof ($handle)) {
$buffer = rtrim ( fgets($handle, 1000) );
fwrite ($fhandle, chown $buffer:html
http://www.php.net/manual/en/function.rtrim.php

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] line breaks

2003-11-25 Thread Rodney Green
John Nichel wrote:



Chances are, $buffer has the line break on it when you read it in from 
the text file.  Try striping off whitespace before you write...

while (!feof ($handle)) {
$buffer = rtrim ( fgets($handle, 1000) );
fwrite ($fhandle, chown $buffer:html
http://www.php.net/manual/en/function.rtrim.php

Thanks John! That was the problem.

Rod

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] line breaks

2003-11-25 Thread John Nichel
Rodney Green wrote:
John Nichel wrote:



Chances are, $buffer has the line break on it when you read it in from 
the text file.  Try striping off whitespace before you write...

while (!feof ($handle)) {
$buffer = rtrim ( fgets($handle, 1000) );
fwrite ($fhandle, chown $buffer:html
http://www.php.net/manual/en/function.rtrim.php

Thanks John! That was the problem.

Rod
Now that I stop and think about it a bit, rtrim() may hurt you here. 
Since you're using a fread to read the text file, it will read the bytes 
you tell it (1000), then move on to the next line of code.  So if you 
have a line as such in your text file...

./command --this=that

and the fread() reaches the byte limit on the whitespace after command, 
it's going to remove that, and you'll end up with

./command--this=that

You can tell rtim() what characters to strip by doing...

rtrim ( $foo, \n );

but I've seen rtrim() strip blank spaces even when this is done.  A 
better way may be to change the way you're reading in the source file; 
instead of using a fread, you can use file(), which will put each line 
in an array element...This way, it won't stop reading in the middle of a 
line

$fhandle = fopen (/scripts/thescript.sh , a);
$handle = file ( /scripts/mail_list.txt );
for ( $i = 0; $i  sizeof ($handle); $i++ ) {
	$buffer = rtrim ( $handle[$i] );
	fwrite ($fhandle, chown $buffer:html 
/scripts/var/spool/mail/$buffer\n, 4096);
}
fclose ($fhandle);

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] line breaks

2003-11-25 Thread Rodney Green
John Nichel wrote:

Rodney Green wrote:

John Nichel wrote:



Chances are, $buffer has the line break on it when you read it in 
from the text file.  Try striping off whitespace before you write...

while (!feof ($handle)) {
$buffer = rtrim ( fgets($handle, 1000) );
fwrite ($fhandle, chown $buffer:html
http://www.php.net/manual/en/function.rtrim.php

Thanks John! That was the problem.

Rod


Now that I stop and think about it a bit, rtrim() may hurt you here. 
Since you're using a fread to read the text file, it will read the 
bytes you tell it (1000), then move on to the next line of code.  So 
if you have a line as such in your text file...

./command --this=that

and the fread() reaches the byte limit on the whitespace after 
command, it's going to remove that, and you'll end up with

./command--this=that

You can tell rtim() what characters to strip by doing...

rtrim ( $foo, \n );

but I've seen rtrim() strip blank spaces even when this is done.  A 
better way may be to change the way you're reading in the source file; 
instead of using a fread, you can use file(), which will put each line 
in an array element...This way, it won't stop reading in the middle of 
a line

$fhandle = fopen (/scripts/thescript.sh , a);
$handle = file ( /scripts/mail_list.txt );
for ( $i = 0; $i  sizeof ($handle); $i++ ) {
$buffer = rtrim ( $handle[$i] );
fwrite ($fhandle, chown $buffer:html 
/scripts/var/spool/mail/$buffer\n, 4096);
}
fclose ($fhandle);

Actually, I'm not having problems with that. The whitespace is still 
there in between the commands and arguments, etc. I'm using fgets , not 
fread. Not sure what the difference between the two is but I'll check it 
out. The problem I am having however is that at the end of the shell 
script that is created it puts an additional line. It writes the chown 
command line for all of the users then puts the following line with no 
user specified.

chown :html /var/spool/mail/

The other lines show up as:
chown rgreen:html /var/spool/mail/rgreen
chown rgreen01:html /var/spool/mail/rgreen01
chown rod:html /var/spool/mail/rod
Any ideas where that extra line is coming from?

thanks again,
Rod
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] line breaks

2003-11-25 Thread John Nichel
Rodney Green wrote:
snip
Actually, I'm not having problems with that. The whitespace is still 
there in between the commands and arguments, etc. I'm using fgets , not 
fread. Not sure what the difference between the two is but I'll check it 
out. The problem I am having however is that at the end of the shell 
script that is created it puts an additional line. It writes the chown 
command line for all of the users then puts the following line with no 
user specified.

chown :html /var/spool/mail/

The other lines show up as:
chown rgreen:html /var/spool/mail/rgreen
chown rgreen01:html /var/spool/mail/rgreen01
chown rod:html /var/spool/mail/rod
Any ideas where that extra line is coming from?

thanks again,
Rod
Is there a carriage return (new line) after the last entry in your text 
file?

You can add an if test in there to stop this...

$buffer = rtrim ( $handle[$i] );
if ( $buffer !=  ) {
fwrite ($fhandle, chown $buffer:html 
/scripts/var/spool/mail/$buffer\n, 4096);
}

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] line breaks

2003-11-25 Thread Rodney Green
John Nichel wrote:

Rodney Green wrote:
snip
Actually, I'm not having problems with that. The whitespace is still 
there in between the commands and arguments, etc. I'm using fgets , 
not fread. Not sure what the difference between the two is but I'll 
check it out. The problem I am having however is that at the end of 
the shell script that is created it puts an additional line. It 
writes the chown command line for all of the users then puts the 
following line with no user specified.

chown :html /var/spool/mail/

The other lines show up as:
chown rgreen:html /var/spool/mail/rgreen
chown rgreen01:html /var/spool/mail/rgreen01
chown rod:html /var/spool/mail/rod
Any ideas where that extra line is coming from?

thanks again,
Rod


Is there a carriage return (new line) after the last entry in your 
text file?

You can add an if test in there to stop this...

$buffer = rtrim ( $handle[$i] );
if ( $buffer !=  ) {
fwrite ($fhandle, chown $buffer:html 
/scripts/var/spool/mail/$buffer\n, 4096);
}

Thanks again, John. That was the problem and the if test fixed it.

Rod

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Line breaks

2003-03-06 Thread Gavin Amm
Hi,

Please help me before I go insane...

I have a basic feedback form with:
  your name
  your e-mail address
  E-Mail Subject
  Message

The problem is the line breaks...

For example, they might type in the following (between the dashed
lines) into the Message textarea:
--
  Hi,

  Please send me some info.

  Thanks,
  Gav
--

When I receive the mail, however, it looks like this:
--
  Hi, Please send me some info. Thanks, Gav
--

This is fine for such a short message, but lengthy messages would be
horrid to read if all the line breaks were taken out... Not to mention
an unprofessional appearance...


I've tried looking at:

- wordwrap()
- preg_replace()
  (because sent from Linux machine to Win machine \r  \n)
- Different WRAP attributes for the textarea. Options are VIRTUAL,
PHYSICAL, and NONE/OFF (can't remember which).

Not sure if there are ways of doing this using the 1st 2? Couldn't
really see anything.

Cheers,
Gav

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Line breaks

2003-03-06 Thread John W. Holmes
 I have a basic feedback form with:
   your name
   your e-mail address
   E-Mail Subject
   Message
 
 The problem is the line breaks...
 
 For example, they might type in the following (between the dashed
 lines) into the Message textarea:
 --
   Hi,
 
   Please send me some info.
 
   Thanks,
   Gav
 --
 
 When I receive the mail, however, it looks like this:
 --
   Hi, Please send me some info. Thanks, Gav
 --
 
 This is fine for such a short message, but lengthy messages would be
 horrid to read if all the line breaks were taken out... Not to mention
 an unprofessional appearance...

You must be sending HTML mail??

Try the nl2br() function. HTML doesn't understand newlines, only br
elements. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Line Breaks in dynamic Download

2002-09-06 Thread Kevin Stone

I have a script that allows clients to download their email lists from a
database.  However I can not get the 'new line' characters (\n \r) to do
their job in Notepad when the download is prompted and the file saved to
disk.  I've simplified the problem with the code below.  Both \n and \r
display as 'null' or undefined characters in Notepad.  What am I doing
wrong?

?
$file = LINE ONE\nLINE TWO\rLINE THREE\n\r;

header(Cache-control: private);
header(Content-type: application/octet-stream);
header(Content-Disposition: attachment; filename=TEST.txt);
echo $file;
?

http://www.helpelf.com/texttest.php Click here to run this code.  You should
be prompted to save the file.  Open the resulting file in Notepad on your
PC.  Tell me if the newlines show as 'null' characters or if each LINE ONE,
LINE TWO, etc. shows up on their own lines.  Mac users also welcome to try
in Simpletext/BBedit.

Much thanks,
Kevin Stone
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Line Breaks in dynamic Download

2002-09-06 Thread Chris Boget

 ?
 $file = LINE ONE\nLINE TWO\rLINE THREE\n\r;

Try this instead and see if it works...

$windowsNewLine = chr(13) . chr(10);

$file = LINE ONE{$windowsNewLine}LINE TWO{$windowsNewLine}LINE 
THREE{$windowsNewLine};

Not sure if Notepad will interpret \r\n correctly...

Chris



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Line Breaks in dynamic Download

2002-09-06 Thread Jay Blanchard

[snip]
I have a script that allows clients to download their email lists from a
database.  However I can not get the 'new line' characters (\n \r) to do
their job in Notepad when the download is prompted and the file saved to
disk.  I've simplified the problem with the code below.  Both \n and \r
display as 'null' or undefined characters in Notepad.  What am I doing
wrong?

?
$file = LINE ONE\nLINE TWO\rLINE THREE\n\r;

header(Cache-control: private);
header(Content-type: application/octet-stream);
header(Content-Disposition: attachment; filename=TEST.txt);
echo $file;
?
[/snip]

They're undefined characters. Notepad has this whole silly Windoze thing
going on requiring a carriage return-linefeed at the end of each line you
wish break. So you will either need to do \r\n or chr(13) chr(10) at each
place you want a break (or a ^m). This happens to be an anomaly with
Notepad, which unlike popular belief is not really a text editor, it just
plays one on TV. Open your file in WordPAd, and prepare to be amazed.

HTH!

Jay

*
* Texas PHP Developers Conf  Spring 2003*
* T Bar M Resort  Conference Center*
* New Braunfels, Texas  *
* Contact [EMAIL PROTECTED]   *
*   *
* Want to present a paper or workshop? Contact now! *
*



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Line Breaks in dynamic Download

2002-09-06 Thread Kevin Stone

Much thanks.  This works but now it won't propmpt the download.  Once the
headers are sent anything going to std out is part of the download correct?
But this is just printing to the screen.  Any thoughts there?

?
header(Content-type: application/octet-stream);
header(Content-Disposition: attachment; filename=TEST.txt);
echo LINE ONE.chr(13).LINE TWO.chr(10).LINE THREE;
?

-Kevin

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: 'Kevin Stone' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 12:55 PM
Subject: RE: [PHP] Line Breaks in dynamic Download


 [snip]
 I have a script that allows clients to download their email lists from a
 database.  However I can not get the 'new line' characters (\n \r) to do
 their job in Notepad when the download is prompted and the file saved to
 disk.  I've simplified the problem with the code below.  Both \n and \r
 display as 'null' or undefined characters in Notepad.  What am I doing
 wrong?

 ?
 $file = LINE ONE\nLINE TWO\rLINE THREE\n\r;

 header(Cache-control: private);
 header(Content-type: application/octet-stream);
 header(Content-Disposition: attachment; filename=TEST.txt);
 echo $file;
 ?
 [/snip]

 They're undefined characters. Notepad has this whole silly Windoze thing
 going on requiring a carriage return-linefeed at the end of each line you
 wish break. So you will either need to do \r\n or chr(13) chr(10) at each
 place you want a break (or a ^m). This happens to be an anomaly with
 Notepad, which unlike popular belief is not really a text editor, it just
 plays one on TV. Open your file in WordPAd, and prepare to be amazed.

 HTH!

 Jay

 *
 * Texas PHP Developers Conf  Spring 2003*
 * T Bar M Resort  Conference Center*
 * New Braunfels, Texas  *
 * Contact [EMAIL PROTECTED]   *
 *   *
 * Want to present a paper or workshop? Contact now! *
 *



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Line Breaks in dynamic Download

2002-09-06 Thread Larry Irwin

Here's what your file contains:

ccadev:/# od -c TEST.txt
000L   I   N   E   O   N   E  \r   L   I   N   E   T   W
020O  \n   L   I   N   E   T   H   R   E   E
034

Wordpad handles it. Notepad does not.
But you have different line terminators for each line
Later,
Larry Irwin

- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 2:48 PM
Subject: [PHP] Line Breaks in dynamic Download


 I have a script that allows clients to download their email lists from a
 database.  However I can not get the 'new line' characters (\n \r) to do
 their job in Notepad when the download is prompted and the file saved to
 disk.  I've simplified the problem with the code below.  Both \n and \r
 display as 'null' or undefined characters in Notepad.  What am I doing
 wrong?

 ?
 $file = LINE ONE\nLINE TWO\rLINE THREE\n\r;

 header(Cache-control: private);
 header(Content-type: application/octet-stream);
 header(Content-Disposition: attachment; filename=TEST.txt);
 echo $file;
 ?

 http://www.helpelf.com/texttest.php Click here to run this code.  You
should
 be prompted to save the file.  Open the resulting file in Notepad on your
 PC.  Tell me if the newlines show as 'null' characters or if each LINE
ONE,
 LINE TWO, etc. shows up on their own lines.  Mac users also welcome to try
 in Simpletext/BBedit.

 Much thanks,
 Kevin Stone
 [EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Line Breaks in dynamic Download

2002-09-06 Thread Jay Blanchard

[snip]
?
header(Content-type: application/octet-stream);
header(Content-Disposition: attachment; filename=TEST.txt);
echo LINE ONE.chr(13).LINE TWO.chr(10).LINE THREE;
?
[/snip]

Try this;

?
header(Content-type: application/octet-stream);
header(Content-Disposition: attachment; filename=TEST.txt);
echo LINE ONE.chr(13).chr(10).LINE TWOchr(13).chr(10).LINE THREE;
?

HTH!

Jay


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Line Breaks in dynamic Download

2002-09-06 Thread Kevin Stone

I used different chars for testing purposes only.  chr() function helped
with the original problem.  Again, the new problem is that the Text is not
downloading as a file.  It is just being printed to the screen.  Any ideas
why it wouldn't be prompting the downloading?

-Kevin

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: 'Kevin Stone' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 1:21 PM
Subject: RE: [PHP] Line Breaks in dynamic Download


 [snip]
 ?
 header(Content-type: application/octet-stream);
 header(Content-Disposition: attachment; filename=TEST.txt);
 echo LINE ONE.chr(13).LINE TWO.chr(10).LINE THREE;
 ?
 [/snip]

 Try this;

 ?
 header(Content-type: application/octet-stream);
 header(Content-Disposition: attachment; filename=TEST.txt);
 echo LINE ONE.chr(13).chr(10).LINE TWOchr(13).chr(10).LINE THREE;
 ?

 HTH!

 Jay


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Line Breaks in dynamic Download

2002-09-06 Thread Steven

snip
Again, the new problem is that the Text is not downloading as a file.  It is
just being printed to the screen.
/snip

I tested the following code:

?
header(Content-type: application/octet-stream);
header(Content-Disposition: attachment; filename=TEST.txt);
echo LINE ONE.chr(10).LINE TWO.chr(10).LINE THREE;
?

on a WinNT 4.0 with Apache 1.3.24 and PHP 4.2.3 and did not come across the
same issues as you.

I was prompted to download or open the file.

However, when I did open the file with Notepad it did not contain any line
breaks, Wordpad did have the line breaks.

HTH
Steven




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Line Breaks in dynamic Download

2002-09-06 Thread Kevin Stone

Thank you all very much.  Turns out it was yet another browser cache issue
and a quick reboot solved the problem.  Minor modification of just two lines
and I'm back in business.  It's the details that'll kill you, eh?  :)

Final code...

?
 header(Cache-control: private);
 header(Content-Type: application/octet-stream);
 header(Content-Disposition: attachment; filename=emaillist.txt);

 $query = SELECT $field_str FROM helpelf_email_lists WHERE clientid='$view'
ORDER BY timestamp DESC;
 $result = mysql_query($query, $db);

 while ($row = mysql_fetch_row($result))
 {
  $file_array = array();
  for ($i=0; $icount($row); $i++)
  {
   // Replace any commas with periods.
   $row[$i] = str_replace(',', '.', $row[$i]);
   $tmp_row = addslashes($row[$i]);
   $file_array[] = $enclosed.$tmp_row.$enclosed;
  }
  $file_tmp = implode($separator, $file_array);
  echo $file_tmp.chr(13).chr(10);
 }
?

Again  much thanks to everyone who helped me.

--
Kevin Stone
[EMAIL PROTECTED]


- Original Message -
From: Steven [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 1:50 PM
Subject: [PHP] Line Breaks in dynamic Download


 snip
 Again, the new problem is that the Text is not downloading as a file.  It
is
 just being printed to the screen.
 /snip

 I tested the following code:

 ?
 header(Content-type: application/octet-stream);
 header(Content-Disposition: attachment; filename=TEST.txt);
 echo LINE ONE.chr(10).LINE TWO.chr(10).LINE THREE;
 ?

 on a WinNT 4.0 with Apache 1.3.24 and PHP 4.2.3 and did not come across
the
 same issues as you.

 I was prompted to download or open the file.

 However, when I did open the file with Notepad it did not contain any line
 breaks, Wordpad did have the line breaks.

 HTH
 Steven




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Line breaks...

2002-04-16 Thread Philip Jeffs

Hi,

I have a form inserting data into a database. I'm using nl2br to add br to the data 
enetered where appropriate.
The data is then pulled out of the database and inserted into text fields for editing.

Can anyone tell me how to remove the br tags while maintaining the line breaks in 
the text field?

Thanks,

Phil
-
 
Philip Jeffs
 
The Tickle Group
The Gate House
Summerseat
Bury
Lancashire
BL9 5PE
United Kingdom
W: http://www.tickle.co.uk
T: 01706 823456
F: 01706 829500
E: [EMAIL PROTECTED] (daytime)
[EMAIL PROTECTED] (evening)
 
-




Re: [PHP] Line breaks...

2002-04-16 Thread Richard Baskett

Don't use nl2br on the data before it goes into the database.  Only use it
when you are showing that data as html.  That way when you pull it into a
textfield you will not have to worry about the br /

Rick

It is very nearly impossible . . . to become an educated person in a country
so distrustful of the independent mind. - James Baldwin

 From: Philip Jeffs [EMAIL PROTECTED]
 Date: Tue, 16 Apr 2002 09:46:43 +0100
 To: PHP LIST [EMAIL PROTECTED]
 Subject: [PHP] Line breaks...
 
 Hi,
 
 I have a form inserting data into a database. I'm using nl2br to add br to
 the data enetered where appropriate.
 The data is then pulled out of the database and inserted into text fields for
 editing.
 
 Can anyone tell me how to remove the br tags while maintaining the line
 breaks in the text field?
 
 Thanks,
 
 Phil
 -
 
 Philip Jeffs
 
 The Tickle Group
 The Gate House
 Summerseat
 Bury
 Lancashire
 BL9 5PE
 United Kingdom
 W: http://www.tickle.co.uk
 T: 01706 823456
 F: 01706 829500
 E: [EMAIL PROTECTED] (daytime)
   [EMAIL PROTECTED] (evening)
 
 -
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Line breaks...

2002-04-16 Thread Jon Haworth

Hi Phil,

 I have a form inserting data into a database. I'm using 
 nl2br to add br to the data enetered where appropriate.
 The data is then pulled out of the database and inserted 
 into text fields for editing.
 Can anyone tell me how to remove the br tags while 
 maintaining the line breaks in the text field?

Don't use nl2br when you're storing the data, use it when you're displaying
it.

// write data to table
$s = INSERT INTO foo SET bar = 'some text \n with a line break';
$q = mysql_query ($s);

// read data from table
$s = SELECT foo FROM bar;
$q = mysql_query ($s);
$r = mysql_fetch_array ($q);
echo this is . nl2br ($r[foo]);

HTH
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] line breaks lost in XSL transformation

2001-07-09 Thread olsonric

I've started experimenting with XML, by having my blogging script output the news to 
XML [http://php.techno-weenie.com/supasite/xml/supa.xml].  I've tried transforming it 
with an XSL stylesheet [http://php.techno-weenie.com/supasite/test.xsl] to get this 
output [http://php.techno-weenie.com/supasite/transform.php].  It looks great, but the 
source code looks really bad.  It looks like it's stripping all the carriage returns 
when it starts matching the news templates.  Does anyone know how to get these back?  
I like to keep my HTML looking at least a little readable, even if the only parts I 
directly edit are the XML and XSL files... 

Here's the source of the PHP script I use:


class xsl {

var $xsl_content;
var $xml_content;
var $result;

function xsl($xml, $xsl) {
  ### open XML and XSL files ###
  $xml_handle = fopen($xml, r) or die(Can't open XML file);
  $xsl_handle = fopen($xsl, r) or die(Can't open XSL file);

  ### get the contents ###
  $this-xml_content = fread($xml_handle, filesize($xml));
  $this-xsl_content = fread($xsl_handle, filesize($xsl));

  ### process files ###
  $handle = xslt_create() or die(Can't create XSLT handle.);
  xslt_process($this-xsl_content, $this-xml_content, $this-result); 

  ### add HTML content to the results ###
  $this-result = str_replace(, , $this-result);
  $this-result = str_replace(, , $this-result);
  @xslt_free($handle);
} # end constructor function
} # end class

$xslt = new xsl(xml/supa.xml, test.xsl);

echo $xslt-result;
-

any assistance would be greatly appreciated

rick
http://techno-weenie.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Line Breaks in textarea

2001-06-29 Thread David Robley

On Thu, 28 Jun 2001 04:44, Nathan Cook wrote:
 Hello-

 I am selecting a value from a blob field in a mysql db.  The value
 looks like this:

 Test 12...3 \r \n br %0%D Test

 When I print that value in a TEXTAREA$value/TEXTAREA -- The
 textarea returns exactly what you see above.  I am trying to get it to
 display a line break (so that I can store the line breaks in the db). 
 If you can shed any light on this subject, please share.

 Thank You,
 Nathan Cook
 [EMAIL PROTECTED]

You might want to make your textarea tag thus:

TEXTAREA WRAP=VIRTUAL$value/TEXTAREA

to show any EOLs as line breaks.

Cue RANT from Richard Lynch on TEXTAREA :-)

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Spell chequers dew knot work write.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Line Breaks in textarea

2001-06-28 Thread Nathan Cook

Hello-

I am selecting a value from a blob field in a mysql db.  The value looks like
this:

Test 12...3 \r \n br %0%D Test

When I print that value in a TEXTAREA$value/TEXTAREA -- The textarea returns
exactly what you see above.  I am trying to get it to display a line break (so
that I can store the line breaks in the db).  If you can shed any light on this
subject, please share.

Thank You,
Nathan Cook
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Line Breaks in textarea

2001-06-28 Thread Alva Chew

try the function nl2br($value)

regards,
Alva Chew

Nathan Cook [EMAIL PROTECTED] wrote in message
00cf01c0ff3d$72992160$[EMAIL PROTECTED]">news:00cf01c0ff3d$72992160$[EMAIL PROTECTED]...
 Hello-

 I am selecting a value from a blob field in a mysql db.  The value looks
like
 this:

 Test 12...3 \r \n br %0%D Test

 When I print that value in a TEXTAREA$value/TEXTAREA -- The textarea
returns
 exactly what you see above.  I am trying to get it to display a line break
(so
 that I can store the line breaks in the db).  If you can shed any light on
this
 subject, please share.

 Thank You,
 Nathan Cook
 [EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Line breaks in PHP

2001-03-29 Thread Matt Davis

I have a  form  that edits the text on a web page by putting the data into a
db and then outputting to the webpage when it is called. When I enter my
text into my form I use the return key to start new lines, but when the text
appears on my webpage it  has no line breaks so the text just wraps to the
width of the page.

Is there any way of PHP picking up these line breaks so that the text will
be formatted on my web page as it was on my form.

Thanks

Matt.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Line breaks in PHP

2001-03-29 Thread Renze Munnik

I think nl2br() is what you're looking for.

RenzE


Matt Davis wrote:
 
 I have a  form  that edits the text on a web page by putting the data into a
 db and then outputting to the webpage when it is called. When I enter my
 text into my form I use the return key to start new lines, but when the text
 appears on my webpage it  has no line breaks so the text just wraps to the
 width of the page.
 
 Is there any way of PHP picking up these line breaks so that the text will
 be formatted on my web page as it was on my form.
 
 Thanks
 
 Matt.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Line breaks in PHP

2001-03-29 Thread Boaz Yahav

check out the nl2br() function.

HTML does not recognize the line breaks, it needs BR for that.

Sincerely

  berber

Visit http://www.weberdev.com Today!!! 
To see where PHP might take you tomorrow.
 

-Original Message-
From: Matt Davis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 29, 2001 11:29 AM
To: Php Mailing List
Subject: [PHP] Line breaks in PHP


I have a  form  that edits the text on a web page by putting the data into a
db and then outputting to the webpage when it is called. When I enter my
text into my form I use the return key to start new lines, but when the text
appears on my webpage it  has no line breaks so the text just wraps to the
width of the page.

Is there any way of PHP picking up these line breaks so that the text will
be formatted on my web page as it was on my form.

Thanks

Matt.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Line breaks in PHP

2001-03-29 Thread Martin Cabrera Diaubalick





nl2br
(PHP 3, PHP 4 )
nl2br -- Inserts HTML line breaks before all newlines in a string
Description
string nl2br (string string)
Returns string with 'br /' inserted before all newlines
***

RTM. Sometimes it helps! :-)

 - Original Message -
 From: Matt Davis [EMAIL PROTECTED]
 To: Php Mailing List [EMAIL PROTECTED]
 Sent: Thursday, March 29, 2001 11:29 AM
 Subject: [PHP] Line breaks in PHP


  I have a  form  that edits the text on a web page by putting the data
into
 a
  db and then outputting to the webpage when it is called. When I enter my
  text into my form I use the return key to start new lines, but when the
 text
  appears on my webpage it  has no line breaks so the text just wraps to
the
  width of the page.
 
  Is there any way of PHP picking up these line breaks so that the text
will
  be formatted on my web page as it was on my form.
 
  Thanks
 
  Matt.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Line breaks in PHP

2001-03-29 Thread Martin E. Koss

When getting the data out of a mySQL table with PHP, use:

$TextArea = nl2br($TextField);

If you are opening it into a form you shouldn't need any formatting as it
will detect the new lines and if using a TEXTAREA the lines will be as you
typed them initially.

If you want to save BRs when saving the data into the table, use the above
but then you won't need it when you pull the data back out.

Martin.

-Original Message-
From: Jason Lotito [mailto:[EMAIL PROTECTED]]
Sent: 29 March 2001 20:30
To: [EMAIL PROTECTED]; Php Mailing List
Subject: RE: [PHP] Line breaks in PHP




 -Original Message-
 From: Matt Davis [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 29, 2001 1:29 AM
 To: Php Mailing List
 Subject: [PHP] Line breaks in PHP


 I have a  form  that edits the text on a web page by putting the
 data into a
 db and then outputting to the webpage when it is called. When I enter my
 text into my form I use the return key to start new lines, but
 when the text
 appears on my webpage it  has no line breaks so the text just wraps to the
 width of the page.

 Is there any way of PHP picking up these line breaks so that the text will
 be formatted on my web page as it was on my form.

 Thanks

 Matt.


http://www.php.net/nl2br  Check out that function.  that is what you
need.

Jason Lotito
www.NewbieNetwork.net
Where those who can, teach;
and those who can, learn.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]