Jump to content


PHP Error


2 replies to this topic

#1 l3lueMage

    Wanna Be Moderator

  • Publishing Betazoids
  • PipPipPipPip
  • 4,596 posts
  • Gender:Male
  • Location:San Francisco Bay Area

Posted 03 May 2006 - 02:50 PM

Okay, I am having some troubles, whenever you load my page it adds an extra blank line which I do not want you can see here:
http://www.tiberium-...net/testing.php

try loading the page a few times it will keep adding blank lines, not sure how to fix it heres my code :S

<head>
<?php

$your_data = $_POST['textarea'];

$fp = fopen("testFile.txt", "a");

fwrite($fp, "\n".$your_data);

fclose($fp);

?>
</head>

<body>

<form id="form1" name="form1" method="post" action="testing.php">
  <textarea name="textarea" cols="50" rows="5"></textarea>
  <br />
  <input type="submit" name="Submit" value="Submit" />
</form>
<p>  <br />
  <?php
$file = @fopen("testFile.txt", "r");
if ($file) {
   while (!feof($file)) {
	   $output = fgets($file, 4096);
	   echo stripslashes($output)."<br />";
   }
   fclose($file);
}
?>
</body>

Edited by l3lueMage, 03 May 2006 - 02:50 PM.


#2 coolaid

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,435 posts
  • Gender:Male
  • Interests:i wonder..

Posted 03 May 2006 - 03:07 PM

could it be cause you're using:
fwrite($fp, "\n".$your_data);
which adds a new line using \n ? try removing the "\n". part

#3 l3lueMage

    Wanna Be Moderator

  • Publishing Betazoids
  • PipPipPipPip
  • 4,596 posts
  • Gender:Male
  • Location:San Francisco Bay Area

Posted 03 May 2006 - 03:13 PM

wow...so obvious cant believe I didnt get it...Thanks :P





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users