AJAX would be the easiest way. Just send an AJAX request to your server to let PHP do the work. Javascript dates can be finicky and more work if you don't know what you're doing. But by utilizing a javascript library like Prototype or jQuery, you can easily boil this down to a few lines:
$('some-element-id').observe('blur', function(evt) {
evt.stop(); // stop event bubbling
new Ajax.Request('/some/url/to/post/to', {
method: 'post', // use POST instead of GET
params: $('form-id').serialize(), // serialize the data to be sent in the request (the entire form)
onSuccess: function(tx) {
alert('Done!');
alert(tx.responseText);
},
onFailure: function(tx) {
alert('Failed check.');
}
});
});
Or for jQuery:
$('#some-element-id').bind('blur', function(evt) {
$.post('/some/url/to/post/to', {
$('#form-element-id').attr('name') : $('#form-element-id').val(),
$('#form-element-id2').attr('name') : $('#form-element-id2').val()
},
function(data) {
alert('Done');
alert(data);
}
});
});
Very similar code, but use the one you like. You could also use Dojo or MooTools or whatever JS library you wish.