php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13365 Adding newline \n in textarea output for each line
Submitted: 2001-09-18 09:01 UTC Modified: 2001-09-18 11:46 UTC
From: jean-pierre dot caurier at price-induction dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.6 OS: Windows 2000 Pro SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jean-pierre dot caurier at price-induction dot com
New email:
PHP Version: OS:

 

 [2001-09-18 09:01 UTC] jean-pierre dot caurier at price-induction dot com
First the HTML source code :

<form action="test.php" METHOD=POST enctype="multiport/form-data">
<textarea name=text cols=20 rows=5>
One line.
Two line
Three line
</textarea>
   <INPUT TYPE="submit" NAME="Submit" VALUE="Save"></CENTER>
</form>

Then test.php source code :

<?
 $fichier = "test.txt";
 $temp = fopen($fichier, "w");
 fputs($temp,stripslashes($text));
 fclose($temp);
 print "Done !";
?>

When I open the test.txt the text isn't save like it would be. 
Here the result :
One line.

Two line.

Three line.

It seems that a \n is added at each end of line of the textarea.

A friend try this code source with PHP 4.0.3pl1 and it works fine.

I have found a solution to have the file well saved using this line code :
$goodtext = str_replace("\n", "", $text);

This is very strange and i can't affirm that it is a bug.

I have also try without enctype="" and with last CVS. this does  nothing better.

Have fun with this ;)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-18 11:06 UTC] sniper@php.net
Not a PHP problem, and not a problem or bug in anything
else either. Please ask support questions elsewhere.

 [2001-09-18 11:46 UTC] jean-pierre dot caurier at price-induction dot com
So how can you explain the difference between two version of PHP ?

I have lost two days in this problem and if I have found a solution has written in my report.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC