Undefined variable.
Posted: Tue Jun 04, 2002 12:46 pm
I got a problem with this code, which should take take a username and a comment from two forms in a html doc, and place the text in a file.
<form action="FormHandler.php" method="POST">
<INPUT type="text" NAME="username" size="30"> <BR>
<TEXTAREA NAME="comment" ROWS=6 COLS=60></TEXTAREA><br>
<input type="submit" value="Send form">
<INPUT TYPE=reset VALUE="Clear">
</form>
<?php
function write() {
$filename = "wall.txt";
$info = $username && "<br>" && $comment;
$line = "<br>----------------------------------------------------<br>";
$openfile = fopen("$filename", "a");
$writetext = $line && $info;
fwrite($openfile, $writetext);
fclose($openfile);
}
write();
?>
But $username is undefined, it says. Can anybody help me out here? If you see another error somewhere, please notice me about that too.
Thanks.
<form action="FormHandler.php" method="POST">
<INPUT type="text" NAME="username" size="30"> <BR>
<TEXTAREA NAME="comment" ROWS=6 COLS=60></TEXTAREA><br>
<input type="submit" value="Send form">
<INPUT TYPE=reset VALUE="Clear">
</form>
<?php
function write() {
$filename = "wall.txt";
$info = $username && "<br>" && $comment;
$line = "<br>----------------------------------------------------<br>";
$openfile = fopen("$filename", "a");
$writetext = $line && $info;
fwrite($openfile, $writetext);
fclose($openfile);
}
write();
?>
But $username is undefined, it says. Can anybody help me out here? If you see another error somewhere, please notice me about that too.
Thanks.