Hi all. I badly need help with my script. My script calculates time a
person has worked. I made it work but for only 1 day. Now I want to
be able to enter times for all different days and for it to work. But
I can't achieve that and I don't know what to do. I am just starting
out so I am not to experienced yet. All your help is greatly
appreciated.
<?php
/*******************************************************************
Time Calculator Version 1.0
Copyright 2002 Roman Demerzhan All Rights Reserved.
E-Mail: hype@f... Script License: GPL
Created 06/27/2000 Last Modified
07/05/2002
**/
function calculatetime($hstart, $hover, $mstart, $mover, $mlover,
$mlstart, $hlstart, $hlover) {
$hstart = $hstart 60; // Converting Hours to Minutes
$hover = $hover 60; // Same as above
$totalout = $hover + $mover; // Total minutes when leaving
$totalin = $hstart + $mstart; // Total minutes when
arrived
$totaltime = $totalout - $totalin; // Time of
departure - time of arrivel
$hlstart = $hlstart 60; //lunch erererererhours
converted to minutes
$hlover = $hlover 60; //same as above
$totaloutlunch = $hlover + $mlover;
$totalinlunch = $hlstart + $mlstart;
$lunch = $totaloutlunch - $totalinlunch; // Total minutes at
lunch
$time = $totaltime - $lunch;
}
?>
<body>
<?php
if ($one) {
calculatetime($hstart, $hover, $mstart, $mover, $mlover,
$mlstart, $hlstart, $hlover);
}
/*********
if ($two) {
calculatetime($two);
}
if ($three) {
calculatetime();
}
if ($four) {
calculatetime();
}
if ($five) {
calculatetime();
}
if ($six) {
calculatetime();
}
if ($seven) {
calculatetime();
}
*************************/
$hours = floor($time/60);
$mins = ($time % 60);
echo ("You have worked for $hours hours and $mins minutes.");
?>
<form action="<?=$PHP_SELF?>" method="post">
<table height="40%" align="center" style="border: dashed 1 #1ebbfe">
<tr>
<td><b>Time of Arrival:</b></td>
<td><input type="text" name="hstart" size="3" maxlength="3"
id="bg"><input type="text" name="mstart" size="3" maxlength="3"
id="bg"></td>
</tr>
<tr>
<td><b>Start of Lunch:</b></td>
<td><input type="text" name="hlstart" size="3" maxlength="3"
id="bg"><input type="text" name="mlstart" size="3" maxlength="3"
id="bg"></td>
</tr>
<tr>
<td><b>End of Lunch:</b></td>
<td><input type="text" name="hlover" size="3" maxlength="3"
id="bg"><input type="text" name="mlover" size="3" maxlength="3"
id="bg"></td>
</tr>
<tr>
<td><b>Time of Departure:</b></td>
<td><input type="text" name="hover" size="3" maxlength="3"
id="bg"><input type="text" name="mover" size="3" maxlength="3"
id="bg"></td>
</tr>
</table><center><br>
<!--
<input type="hidden" value="TRUE" name="one">
<table height="40%" align="center" style="border: dashed 1 #1ebbfe">
<tr>
<td><b>Time of Arrival:</b></td>
<td><input type="text" name="hstart" size="3" maxlength="3"
id="bg"><input type="text" name="mstart" size="3" maxlength="3"
id="bg"></td>
</tr>
<tr>
<td><b>Start of Lunch:</b></td>
<td><input type="text" name="hlstart" size="3" maxlength="3"
id="bg"><input type="text" name="mlstart" size="3" maxlength="3"
id="bg"></td>
</tr>
<tr>
<td><b>End of Lunch:</b></td>
<td><input type="text" name="hlover" size="3" maxlength="3"
id="bg"><input type="text" name="mlover" size="3" maxlength="3"
id="bg"></td>
</tr>
<tr>
<td><b>Time of Departure:</b></td>
<td><input type="text" name="hover" size="3" maxlength="3"
id="bg"><input type="text" name="mover" size="3" maxlength="3"
id="bg"></td>
</tr>
</table><center><br> -->
<input type="hidden" name="two" value="TRUE">
<input type="submit" value="Click Here!" style="border: 1 dashed
#1ebbfe"><input type="reset" value="Reset" style="border: 1 dashed
#1ebbfe">
</form>
</body>