Hi,
Can somebody help me to automate the total of hours on my field.
ex I have 3 fields
datetime1 = textfield
datetime2 = textfield
total = textfield
I want to show the result in my total field when I select the date/time in my datetime1 and datetime2 it should be automated field.. below is my code..
$date1 = new DateTime($textFromDate);
$date2 = new DateTime($textToDate);
$diff = $date2->diff($date1);
$hours = $diff->h;
$hours = $hours + ($diff->d*8);
$total = $hours / $per_day;
Thank you very much!
Onchange
Moderator: General Moderators
Re: Onchange
And what's the problem with it?
Re: Onchange
I have field total result. and I want to show the result on it everytime I select dates in my two datetime.
Re: Onchange
Okay, well, you've got that $total variable there with (presumably) what you want to show, so... echo it out. Or be a lot more descriptive about what you're trying to do, because neither "show the result" nor "everytime I select dates in my two datetime" really means anything.
Re: Onchange
yeah your right! but I want to add some effects on my $total field. I want it to be live, when I change my dates it always change too.