When I clicked on a day in the calendar, I open popup window and set day, month and year to it's URL. I then read those info in popup info, along with the content and insert that into table.
Here's the (relevant) code:
<form action="add.php" method="post">
Title: <input type="text" name="title" /><br />
Content: <textarea name="content" /></textarea><br />
<input type="submit" name="submit" value="Add" />
</form>
<?php
if (isset($_POST['submit'])) {
$date = $_GET['y'] . "-" . $_GET['m'] . "-" . $_GET['d'];
if ($_POST['content'] == null || $_POST['content'] == "" || $_POST['content'] == " ") {
?>
<font style='color: #FF0000; font-size: 12px;'>Empty fields are not allowed.</font><br />
<a href='javascript: self.close(); '>Close this window!</a>
<?php
exit;
}
$title = mysql_real_escape_string($_POST['title']);
$content = mysql_real_escape_string($_POST['content']);
$uid = 1;
mysql_query("INSERT INTO event(uid, title, content, date) VALUES ($uid, '$title', '$content', '$date') ") or
die("<b>Error while inserting:</b> " . mysql_error() . "<br /><a href='javascript: self.close(); '>Close this window!</a>");
}
?>
After I insert I get 0000-00-00 in date field.


Sign In
Create Account


Back to top









