On Thu, 12 Jul 2001 08:09, Chris Cocuzzo wrote:
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
brbr
input type=submit name=submitnbsp;nbsp;
input type=reset name=resetbr
-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!
You aren't setting a value for submit, so you might be better checking
for either isset($submit) or !empty($submit) rather than if($submit).
Otherwise try assigning a value to submit in the input tag.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Avoid temporary variables and strange women.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]