I am facing some problem in my code I want to calculate the total pay of the employers but unfortunately I am unable to figure it out. I want to add the total such like if the person works normal hours means (9 hours) and overtime as Monday to friday overtime <=3h his pay will be +15% and if overtime >3h it will be +22%. Saturday Normal hours will be +$6 hour, Sunday and holiday normal hours == +$8 hour, Weekend and holidays overtime hours == +40% and in the I' have to multiple the number of hours by the position. if the position is manager so I want to multiple it by $30 if not then the price will be $25. Here is my code:
// this php code //
<?php
$position = $hours = $overtime = $sunday = $saturday = $Wekened = 0;
if (isset($_GET['post']) && isset($_GET['hours']) && isset($_GET['overtime'])) && isset($_GET['Sunday'])) && isset($_GET['Saturday'])) && isset($_GET['weekend']))
{
$post = $_GET['post'];
$hours = $_GET['hours'];
if (!is_text($post)) || (!is_numeric(hours)) || (!is_numeric($overtime)) || (!is_numeric($saturday)) || (!is_numeric($sunday)) || (!is_numeric($weekend))
{
$res = NULL;
}
else
{
$cal = $_GET['opt'];
switch($cal)
{
case 'add' and 'multiply':
$res = ($overtime + $hours + sunday + saturday) * position;
default:
$res = NULL;
}
}
}
?>
// display html on the same file
<html>
<body>
<form action="checkpart2.txt" method="GET"/>
Postion:<input type="text" name="post"/><br/>
Hours: <input type="text" name="hours"/><br/>
<div id="checkbox1">
Overtime:
<input id="Checkbox1" type="checkbox"/>
</div>
<select>
<option type="text" name="opt" value="hour"> 1 </option>
<option type="text" name="opt" value="hour"> 2 </option>
<option type="text" name="opt" value="hour"> 3 </option>
<option type="text" name="opt" value="hour"> 4 </option>
<option type="text" name="opt" value="hour"> 5 </option>
<option type="text" name="opt" value="hour"> 6 </option>
<option type="text" name="opt" value="hour"> 7 </option>
<option type="text" name="opt" value="hour"> 8 </option>
</select>
<br />
Saturday:
<input id="Checkbox1" type="checkbox"/>
</div>
<select>
<option type="text" name="opt" value="hour"> 1 </option>
<option type="text" name="opt" value="hour"> 2 </option>
<option type="text" name="opt" value="hour"> 3 </option>
<option type="text" name="opt" value="hour"> 4 </option>
<option type="text" name="opt" value="hour"> 5 </option>
<option type="text" name="opt" value="hour"> 6 </option>
<option type="text" name="opt" value="hour"> 7 </option>
<option type="text" name="opt" value="hour"> 8 </option>
</select>
<br />
Sunday:
<input id="Checkbox1" type="checkbox"/>
</div>
<select>
<option type="text" name="opt" value="hour"> 1 </option>
<option type="text" name="opt" value="hour"> 2 </option>
<option type="text" name="opt" value="hour"> 3 </option>
<option type="text" name="opt" value="hour"> 4 </option>
<option type="text" name="opt" value="hour"> 5 </option>
<option type="text" name="opt" value="hour"> 6 </option>
<option type="text" name="opt" value="hour"> 7 </option>
<option type="text" name="opt" value="hour"> 8 </option>
</select>
<br />
<input type="submit" value="calculate"/>
</form>
<? if (isset($res) && $res != NULL): ?>
<span class="result-label">Result:</span> <span class="result"><?=$res?></span>
<? endif ?>
</body>
</html>