[PHP] \n is not working!

2004-04-04 Thread Labunski
\n isn't working properly.

Why do this line $new_topic = $post_0.'|'.$post_1.'|'.'$post_2\n'; writes to
the document
one|two|three\n
but not
one|two|three (and break)



whole code:

if ($a==new){
$post_0 = $_POST[one];
$post_1 = $_POST[two];
$post_2 = $_POST[three];
 if ($post_1 !=){
 if ($post_2 !=){
$m_fails=fopen('../data/menu.txt','a');
$new_topic = $post_0.'|'.$post_1.'|'.'$post_2\n';
fwrite($m_fails,$new_topic);
fclose($m_fails);
}}
}

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



Re: [PHP] \n is not working!

2004-04-04 Thread Robert Cummings
On Sun, 2004-04-04 at 17:58, Labunski wrote:
 \n isn't working properly.
 
 Why do this line $new_topic = $post_0.'|'.$post_1.'|'.'$post_2\n'; writes to
 the document
 one|two|three\n
 but not
 one|two|three (and break)

Because it's in single quotes versus a double quotes.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] \n is not working!

2004-04-04 Thread Chris Shiflett
--- Labunski [EMAIL PROTECTED] wrote:
 Why do this line $new_topic = $post_0.'|'.$post_1.'|'.'$post_2\n';
 writes to
 the document
 one|two|three\n

Actually, that's not true. Assuming:

$post_0 = 'one';
$post_1 = 'two';
$post_2 = 'three';

The code you posted will store the following in $new_topic:

one|two|$post_2\n

While others were able to answer your question anyway (anything within
single quotes is interpreted literally), this demonstrates how providing
misinformation can make it very difficult for people to help you.

As a courtesy to those who spend their time answering questions, please
test your code. It really only takes a moment of your time.

Thanks. :-)

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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