Re: RE: [PHP-DB] <TEXTAREA in and out of the db>

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: RE: [PHP-DB] <TEXTAREA in and out of the db>
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-14063@lists.php.net to get a copy of this message
Just at a quick glance: You don't seem to have a call to fread(): This is how I have employed it to read the content of a text file: //get contents of a file into a string $filename = "/path/to/textfile/myfile.txt"; $fd = fopen($filename, "r"); $contents = fread($fd, filesize ($filename)); fclose ($fd); $contents should have the content of 'myfile.txt' Good luck! Russ On Tue, 6 Nov 2001 17:26:45 +0100 Michiel_Lange@actuera.com wrote: > To make it a bit clearer: > > this is the editit.php (only edited it to translate the dutch out of it :P) > > <HTML> > <HEAD> > <TITLE>File <?php print($best); ?></TITLE> > </HEAD> > <BODY> > <?php > $pad="/home/user1/$best"; > $inhoud = file($pad); > /* > while(list ($line_num,$line) = each($inhoud)) > { > echo htmlspecialchars($line) ."<BR>\n"; > } > */ > print("<FORM METHOD=\"POST\" ACTION=\"applyedit.php?best > =$best\">"); > print("<TEXTAREA ROWS=40 COLS=80 NAME=content>"); > while(list ($line_num,$line) = each($inhoud)) > { > print(htmlspecialchars($line) . "\n"); > } > print("</TEXTAREA>"); > print("<BR>"); > print("<INPUT TYPE=SUBMIT VALUE=\"Save\">"); > print("</FORM>"); > ?> > </BODY> > </HTML> > > -------------------------------------------------------------------------------------------------------------------------------- > This works fine it seems, the text appears in the textare... so that was > not the problem. The problem arises with the next script, > where $content does not appear to have any text in it... > > applyedit.php > <HTML> > <HEAD> > <TITLE>File <?php print($best); ?></TITLE> > </HEAD> > <BODY> > <?php > $pad="/tmp/$best"; > if(file_exists($pad)) > { > print("$pad had to be deleted first.<BR>"); /* safety > measure, fopen($blah, "w") ought to create a new file */ > unlink($pad); > } > $fp=fopen($pad,"w"); > print("Content:<BR>"); > print("$content"); /* there's nothing printed, so I assume $content > is empty */ > fputs($fp,htmlspecialchars($content) . "\n"); /* even > htmlspecialchars() does not put anything in the file $content is really > empty? */ > fclose($fp); > ?> > /* this part is not so interesting, just some aid in browsing *. > Completed saving.<BR> > Click <A HREF= "http://starting.page.org/update.html"StÕ֨Ö° > ·O>here</A> to go back > to the update page.<BR> > Or click <A > HREF="http://starting.page.org">here</A> to go to > the main > site. > <BR> > </BODY> > </HTML> > > ----------------------------------- > I hope that clears it a bit up... so you can enlighten me :) > > TIA > Michiel Lange > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > #-------------------------------------------------------# "Believe nothing - consider everything" Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: r.j.michell@apu.ac.uk w: www.apu.ac.uk/webteam www.theruss.com #-------------------------------------------------------#

« previous php.db (#14063) next »