This is what I have so far. What I want to learn is how to setup a the paremeters for the database in order to have data pushed into it from my form:
My html form page:
<html>
<head>
<title>Guestbook</title>
</head>
<body>
<h2><center>Welcome</center></h2>
<h3><center>Please sign the Guestbook</center></h3>
<form action="guestresult.php" method="POST">
Full Name: <input type="text" name="fullname"><br<br>
E-Mail: <input type="text" name="email"><br><br>
Location: <input type="text" name="location"><br><br>
Comments: <textarea name="comments"></textarea><br><br>
<input type="submit" value="Submit">
<?php
$user = "safe_mysqld";
$pass = "";
$db = "techigloo";
$link = mysql_connect("localhost",$user,$pass);
if (!$link) {
die('Could not connect: ' . mysql_error());
} else {
echo 'Connected successfully';
}
mysql_close($link);
?>
and my guestresult.php page...
<html>
<head>
<title>Guestbook</title>
</head>
<body>
<b>Here's the summary of what you inputted:</b>
<br><br>
<?php
if (empty($fullname)) {
echo "<font color=red><b>You didn't fill in your full name!</font>b</b><br><br>";
// Evaluates as true because $var is set
} else {
echo "Hi! $fullname. Welcome to the best website in the
//world! - Techigloo.com<br><br>";
}
if (empty($email)) {
echo "<font color=red><b>You didn't fill in your e-mail address!</font></b><br><br>";
// Evaluates as true because $var is set
} else {
echo "Your e-mail address is $email<br><br>";
}
if (empty($location)) {
echo "<font color=red><b>You didn't fill in your location!</font></b><br><br>";
// Evaluates as true because $var is set
} else {
echo "Your location is $email<br><br>";
}
echo "Here is what you had to say:<br><br>";
print "$comments<br><br>";
?>
<br>
<A HREF="guestbook.php">Return to Guestbook Sign-up page</A>
<br>
<A HREF="guestview.php">View Guestbook</A>
</body>
</html>
I have setup a database called techigloo.
A table called guestbook with 3 tables called fullname, email, and location.
Thanks.
Adrian