| Issue 1248: | Click to new event Add to Mysql with php | |
| 3 people starred this issue and may be notified of changes. | Back to list |
i have a question in Selectable.html
i want to select 1 day and click to top. Add new title, is here please look codes
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
"lunch" > post to > newdata.php write title start end all day
i want to this information write to database with php. how i do ?
Thanks a lot of
Jan 15, 2012
#1
baristur...@gmail.com
Jan 25, 2012
write this one
var liveDate = new Date(); // current Date
selectable: true, // set false if you want to select only one day at a time
selectHelper: true,
select: function (startDate, endDate, allDay, jsEvent) {
// I use if because i dont want to add and event to any past dates
if (liveDate > startDate) {
alert('This date has been passed');
return false;
} else {
var title = prompt('New Charges:');
if (title) {
calendar.fullCalendar('renderEvent', {
title: title,
start: startDate,
end: endDate,
allDay: allDay
}, false // make the event "unstick"
);
var startDateString = $.fullCalendar.formatDate(startDate, 'yyyy-MM-dd');
var endDateString = $.fullCalendar.formatDate(endDate, 'yyyy-MM-dd');
$.ajax({
type: 'POST',
url: './new_event.php?action=add',
data: {
startDate: startDateString,
endDate: endDateString,
eventTitle: title
},
dateType: 'json',
success: function (resp) {
calendar.fullCalendar('refetchEvents');
}
});
} // end of inner if
} // end of else
calendar.fullCalendar('unselect');
},
now on new_events.php
if(isset($_POST['eventTitle'])) {
$title = (int)$_POST['eventTitle'];
if(empty($title)){
echo json_encode(false);
exit;
}
}
$action = $_GET['action'];
if($action =='add')
{
$sql = "INSERT INTO { your db } SET
start_date = '".$_POST['startDate']."' ,
end_date = '".$_POST['endDate']."',
event_title = '".$_POST['eventTitle']."' ";
$query = $db->query($sql);
echo json_encode($query);
}
Hope this will help.
Jan 25, 2012
thanks a lot. You are perfect.
Nov 6, 2012
Where should i put this?
var liveDate = new Date(); // current Date
selectable: true, // set false if you want to select only one day at a time
selectHelper: true,
select: function (startDate, endDate, allDay, jsEvent) {
// I use if because i dont want to add and event to any past dates
if (liveDate > startDate) {
alert('This date has been passed');
return false;
} else {
var title = prompt('New Charges:');
if (title) {
calendar.fullCalendar('renderEvent', {
title: title,
start: startDate,
end: endDate,
allDay: allDay
}, false // make the event "unstick"
);
var startDateString = $.fullCalendar.formatDate(startDate, 'yyyy-MM-dd');
var endDateString = $.fullCalendar.formatDate(endDate, 'yyyy-MM-dd');
$.ajax({
type: 'POST',
url: './new_event.php?action=add',
data: {
startDate: startDateString,
endDate: endDateString,
eventTitle: title
},
dateType: 'json',
success: function (resp) {
calendar.fullCalendar('refetchEvents');
}
});
} // end of inner if
} // end of else
calendar.fullCalendar('unselect');
},
Dec 20, 2012
i use the above code for inserting the newly created event into database.but the file new_event.php is not executing and nothing is inserting into the database.i worked on Selectable.html.i gave the url correctly in the ajax function.but nothing will happen.Please help me......
Aug 14, 2013
(No comment was entered for this change.)
Status:
Invalid
|
|
| ► Sign in to add a comment |