Question: With your Guestbook visible in your browser, type your name, email address and some comments in the associated text fields. Click the [ submit ]
With your Guestbook visible in your browser, type your name, email address and some comments in the associated text fields. Click the [ submit ] button. Return to your server location that is storing your files in the MyData folder. Notice that your data that you just entered is stored in the comments.txt text file.
if (isset($_POST['submit'])) {
$filename = "comments.txt";
$fp = fopen($filename, "a");
$myName = $_POST["txtName"] . " ";
$myEmail = $_POST["txtEmail"] . " ";
$myComments = $_POST["txtComments"] . " ";
//set the time stamp
$date = date("l, F j, Y") . " ";
$time = date("h:i A") . " ";
fwrite($fp, $date);
fwrite($fp, $time);
fwrite($fp, $myName);
fwrite($fp, $myEmail);
fwrite($fp, $myComments);
fclose($fp);
$url = "summary.php";
header("Location: $url");
}
?>
GuestBook
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
