I created a php button in a form to calculate the difference between two time values entered in the form. I would like to add some kind of submit button to allow the calculated value to be entered automatically in the same form. Is it possible? or is there another way of doing it?
So far, the form looks like this:
The php button “Calculer temps” is:
$d1 = {fin};
$d2 = {debut};
$d1_timestamp = strtotime($d1);
$d2_timestamp = strtotime($d2);
$time = ($d1_timestamp - $d2_timestamp) / 60 / 60;
echo “Total de $time heures”;
It opens in a new window and I would like the OK button (or to add a new one) to enter the $time value in the nb_heures fields in the form…
I tried to code a button in php but I get this error : Parse error: syntax error, unexpected ‘<’ in /opt/NetMake/v7/wwwroot/scriptcase/app/feuille_de_temps/form_temps/form_temps_apl.php on line 1190
I am not a programmer and I am learning to use both scriptcase, php and mysql. So any help would be appreciated.
If there is another way to calculate the value and to add it in the form, I am open to ideas.