kawasaki Posted March 15, 2009 Share Posted March 15, 2009 I have made a calendar and made files to insert *EVENTS* on given dates. Right now i have it to insert on just a date format date(m - d - Y). What i am trying to figure out how to do is for a user to insert a STARTDATE and ENDDATE in a form and it will insert for all those dates. Maybe multiple entries with each date or a do a STARTDATE and Number of days staying, type deal. Does anyone have the answer of how to accomplish this? The code for adding i have is this if ( isset($_POST["submit"]) && !empty($event_desc)) { $eventyear = $_POST['eventyear']; $eventmonth = $_POST['eventmonth']; $eventdate = $_POST['eventdate']; $day_in_a_mth = date('t', mktime(0, 0, 0, $eventmonth, 1, $eventyear)) ; if ($day_in_a_mth >= $eventdate ) { $fulldate = $eventyear."-".$eventmonth."-".$eventdate; $event_desc = $_POST['event_desc']; $sql = "INSERT INTO event SET date='$fulldate', event_desc='$event_desc'"; $query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error()); //message( "ADD EVENT", "DATA ENTERED"); echo "Your Trout Shack Stay has been added to the calendar. Would you like to add more? <a href='caladd.php'>Add to Calendar<a>"; } else { message( "ERROR", "DATE ENTERED NOT VALID"); } Link to comment https://forums.phpfreaks.com/topic/149453-how-to-insert-mutiple-dates-in-mysql-for-a-calendar/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.