/*
this material is provided with ABSOLUTELY NO GUARANTEE. use at your own risk.
always test on non-critical systems first.
source code developed by Melonfire, http://www.melonfire.com/
copyright 2001, Melonfire. all rights reserved.
visit our Web site to find out how you can use this source code and accompanying article on your Web site.
*/
?>
// form not submitted
if (!$submit)
{
// format date
$this_date = $currYear . "-" . sprintf("%02d", $currMonth) . "-" . sprintf("%02d", $currDay);
?>
}
else
{
include("config.php");
// format time
$this_time = $hh . ":" . $mm . ":00";
// set up default description
if ($comment == "") { $comment = "Not available"; }
// open a connection to the database
$connection = mysql_connect($server, $user, $pass);
// formulate the SQL query - same as above
$query = "INSERT into calendar VALUES (NULL, '$this_date', '$this_time', '$comment')";
// run the query on the database
// assume the database is named "php101"
$result = mysql_db_query($db,$query ,$connection);
// close connection
mysql_close($connection);
header("Location: day.view.php?currYear=" . $currYear . "&currMonth=" . $currMonth . "&currDay=" . $currDay);
}
?>