I thought I would display this code in the body of the message, because I
dont want people to worry about the attachment containing a virus. Can't
seem to figure out why this is added blank lines when writing the file.
The DEFAULT case opens the file and loads it into a Form Textarea. CASE 1
then re-writes the file with the textarea variable. If there was a blank
lane in the textarea, it gets written as two blank lines.
Please help.
-----------------------------
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/headline_admin.css" />
</head>
<body>
<?
/****************************************************/
/* BEGIN SWITCH 'CASE' */
/****************************************************/
switch ($case) {
case 2:
/****************************************************/
/* CASE 2 CASE 2 CASE 2 */
/****************************************************/
$includefile = stripslashes($includefile);
$file = fopen("$file_name", "w") or die("could not open.");
$fp = fwrite($file, $includefile) or die("could not write.");
fclose($file);
echo("$file_name created.");
break;
default:
/****************************************************/
/* DEFAULT DEFAULT */
/****************************************************/
/****************************************************/
/* VARIABLE DEFINITIONS */
/****************************************************/
$file_name = "D:\Inetpub\wwwroot\includes\portal_links.inc";
$files_array = file("$file_name");
echo("<table align=center><tr><th>Editing:
$file_name</th></tr><tr><td><br>");
echo("<form action=portal_edit.php method=post><input type=hidden
name=case value=2>");
echo("<input type=hidden name=file_name value=$file_name>");
echo("<textarea cols=100 rows=35 wrap=off name=includefile>");
for ($t = 0; $t < count($files_array); $t++){
echo("$files_array[$t]");
}
echo("</textarea><br><input type=submit value=save></form>");
echo("</td></tr></table>");
break;
}
/****************************************************/
/* END SWITCH 'CASE' */
/****************************************************/
?>
"Benjamin Delman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> attached is a script i wrote to open a file, display it's contents in a
> textarea, then submit to a different case where the file is re-written.
>
> what i notice is that when there is a blank line, after re-writing that
> blank line gets doubled. so there are now two blank lines where there was
> one. why is this? anyone know how to prevent this from happening?
>
> many thanks for you help.
>
> benjamin
>
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php