", " "); $this = strtr($this, "<", " "); $this = strtr($this, "|", " "); $$key = $this; } //////////////////////////////// // This will catch if someone is trying to submit a blank // or incomplete form. //////////////////////////////// if ($name && $email && $message ) { //////////////////////////////// // This is the meat of the query that updates the guests table //////////////////////////////// $query = "INSERT INTO $dbtable"; $query .= "(guest_id, guest_name, "; $query .= "guest_email, guest_time, guest_message) "; $query .= "values(0000,'$name','$email',NULL,'$message')"; mysql_pconnect("$dbhost","$dbuserid","$dbpasswd") or die("Unable to connect to SQL server"); mysql_select_db("$dbname") or die("Unable to select database"); mysql_query($query) or die("Insert Failed!"); } else { //////////////////////////////// // If they didn't include all the required fields set a variable // and keep going. //////////////////////////////// $notall = 1; } } ?>
Please answer all fields
} ?>Name: echo $guest['guest_name']; ?> | Email: echo $guest['guest_email']; ?> | //////////////////////////////// // The database has a timestamp record type that we can use to show the // date the guestbook was filled out. //////////////////////////////// $datefromdb = $guest['guest_time']; $year = substr($datefromdb,0,4); $mon = substr($datefromdb,4,2); $day = substr($datefromdb,6,2); $hour = substr($datefromdb,8,2); $min = substr($datefromdb,10,2); $sec = substr($datefromdb,12,2); $orgdate = date("l F dS, Y h:i A",mktime($hour,$min,$sec,$mon,$day,$year)); echo "Date: $orgdate\n"; ?> |
echo $guest['guest_message']; ?> |