The script is not having the desired effect. The message entered is not being written into the text file. If I replace line: fwrite($file, $message); with fwrite($file, "Hellow World"); It works, suggesting that variable $message is not storing any data. Any help would be most appreciated The HTML Script:
<body>
<form method="post" action="">
<textarea name="WMessage" rows ="5" cols="40"></textarea> Enter your message!<br />
<input type="submit" name="submit" value="Save Message">
</form>
The PHP Script:
<?PHP
if($_POST['submit'] == "Save Message") {
$message = $_Post["WMessage"];
$file = fopen("test.txt", "w") or die("can't open file");
fwrite($file, $message);
fclose($file);
}
echo $message;
?>
This $_Post
in $_Post["WMessage"];
must be in uppercase, it's a superglobal.
http://php.net/manual/en/language.variables.superglobals.php
$_POST["WMessage"];