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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started