That helps some, i was right. You’re right about the math though, its what i get for looking at this at 5am. So those date fields are filled in from the javascript then? If you want the notification immediately, then you either need to use js or an ajax script. There’s lots of tutorials on js data comparison, but i found this on stackoverflow
function d_check() {
var dl_sdt=document.getElementIdBy("date_input_Id1").value; //date one
var dl_endt=document.getElementIdBy("date_input_Id2").value; //date two
if((dl_sdt.substr(6,4)) > (dl_endt.substr(6,4))) {
alert("first date is greater");
return false;
}
else if((((dl_sdt.substr(0,2)) > (dl_endt.
substr(0,2)))&&(frdt(dl_sdt.substr(3,2)) > (dl_endt.substr(3,2))))||
(((dl_sdt.substr(0,2)) > (dl_endt.substr(0,2)))&&
((dl_sdt.substr(3,2)) < (dl_endt.substr(3,2))))||
(((dl_sdt.substr(0,2)) == (dl_endt.substr(0,2)))&&((dl_sdt.substr(3,2)) >
(dl_endt.substr(3,2))))) {
alert("first date is greater");
return false;
}
alert("second date is digher");
return true;
}[/code]
If you wanted to use ajax, then you'd just put what you have in a seperate page and pass the variables via the url string. something like
[code]<script language="javascript" type="text/javascript">
<!--
//Browser Support Code
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
//document.myform.time.value = ajaxRequest.responseText;
var ajaxDisplay = document.getElementById('n_answer');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var a_id = document.getElementById('danswer').value;
var queryString = "?a_id=" + a_id;
ajaxRequest.open("GET", "ajax_query.php" + queryString, true);
ajaxRequest.send(null);
}
//-->
</script>
That’s from one of my projects. Its for querying a database, but it can be changed to suit your needs easily enough.