I'm puzzled. TEXTAREA related.

From: Date: Wed, 11 Jul 2001 22:39:59 +0000
Subject: I'm puzzled. TEXTAREA related.
Groups: php.general 
Request: Send a blank email to php-general+get-57504@lists.php.net to get a copy of this message
hey- i have a page containing a form with a textarea field. The first part of the page is a quick IP check to make sure the request is coming from my computer. Here's the code I'm confused about: <textarea rows="25" cols="80" name="news_info" style="BACKGROUND-COLOR: rgb(31,31,31); BORDER-BOTTOM: rgb(0,0,0) 1px solid; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; COLOR: rgb(255,255,255); FLOAT: none; FONT-FAMILY: verdana; FONT-SIZE: 8pt; LETTER-SPACING: normal; LINE-HEIGHT: normal; MARGIN-LEFT: 0px; PADDING-BOTTOM: 1px; PADDING-TOP: 1px; TEXT-ALIGN: left; TEXT-INDENT: 0px; VERTICAL-ALIGN: middle"> <?php readfile("lib/news_file.dat"); ?> </textarea> <br><br> <input type="submit" name="submit">&nbsp;&nbsp; <input type="reset" name="reset"><br> -this part above reads in data from the news file and it's put in between the textarea tags, so editing it is easier, then there is this part: <?php } if($submit) { $fileh = fopen("lib/news_file.dat", "w"); fwrite($fileh, $news_info); fclose($fileh); } ?> - that checks if the submit button was pressed, and if so, it writes the data from the textarea to the file - the problem I noticed was that if I submit with something in the textarea, it doesn't display when the page loads again, which is weird, because the action of the form is directed to the same page. but, if I press submit an addditional time, the data I entered in the first time comes up...I don't understand why it's not immediately showing up, since it does write to the file when submit is pressed please help!

« previous php.general (#57504) next »