I am working on a project of web calendar. I want to add my php database file to the java script file. When I click on the save button of calendar, the entries showed in calendar, but I m unable to add PHP file to save button. So when I click on save button, the entry should go to the database(php file).
code goes here:-
buttons:
{
save : function()
{
calEvent.id = id;
id++;
calEvent.start = new Date(startField.val());
calEvent.end = new Date(endField.val());
calEvent.title = titleField.val();
calEvent.body = bodyField.val();
$calendar.weekCalendar("removeUnsavedEvents");
$calendar.weekCalendar("updateEvent", calEvent);
$dialogContent.dialog("close");
},
cancel : function() {
$dialogContent.dialog("close");
}
}
There is no such thing as a "PHP database", and you cannot add PHP to your JavaScript file.
Your save button needs to send data to a PHP via page via HTTP, either by regular post-back or AJAX. The page will reside and execute on your server, while the JavaScript calendar executes in the client's browser. That PHP page can then talk to a database server to store/retrieve data for you.
Your server must:
You must understand that a database is at the server end (sometime the web server).
It could by Sybase, MySql, SQLite, ...
Nothing to do with the server.
Javascript on the browser can and sometimes is turned off. It just makes it easier and more interactive to use the web pages.
So why should summat go to a php file? This makes no sense along with php base. Please have a little reflection on the various technologies involved.