Click to See Complete Forum and Search --> : Writing Large Content To A File


spykemitchell
08-22-2005, 11:53 AM
I'm creating a very basic WYSIWG HTML editor for some friends of mine to edit their website as they're all HTML illiterate. The logistics of the actual editor isn't too hard but actually getting the information from a textarea in that page into another PHP file is something I'm not very good at (i'm actually not very good at PHP at all and If anyone can recomend some good books i can get, off amazon preferably, that would help a lot).

how would I write the entire contents of a textarea or multiple textareas to a php file?

Thanks in advance!

Spyke.

ricosushi
08-22-2005, 12:48 PM
Hi.

I suppose you want to display the data from a HTML document into another document such an .php.

The mechanichs its simple. Just create a FORM where you colect the data in a textarea. Then thru a submit button you send the form data to an PHP to be processed and displayed.

////////////// HTML FORM ///////////////

<FORM name="form1" action="display.php" method="get">
<TEXTAREA name="data"></TEXTAREA>
<INPUT type="submit" name="Submit" value="Submit">

ricosushi
08-22-2005, 12:54 PM
Sorry heres the php part.

////////////// PHP ///////////////
<?php
//assign the value from the form to a variable called text
$text = $_GET['data'];

//print the value on screen
echo nl2br( $text; );

//Note i used the nl2br() function in order to display return carriages

greetings.

=)

spykemitchell
08-24-2005, 01:04 PM
I think I wasn't very clear on that. Sorry. I need to write the textarea to a database file really (.db) and then I can echo the information from that. Thanks for helping so far. Or will yours do that? I don't know what the nl2br function does exactly. :)

Spyke.

Mau
08-24-2005, 02:53 PM
nl2br (http://us2.php.net/manual/en/function.nl2br.php) is the same as str_replace("\n",'<br />',$subject);