<form method="post" action="">
<table>
<tr>
<td>
<label for="status">Status:</label>
</td>
<td>
Single
<input type="radio" name="status" value="single" required="true"/>
</td>
</tr>
<tr>
<td>
</td>
<td>
Head of household
<input type="radio" name="status" value="head_of_household" required="true"/>
</td>
</tr>
<tr>
<td>
</td>
<td>
Married
<input type="radio" name="status" value="married" required="true"/>
</td>
</tr>
<tr>
<td>
<label for="salary">Salary: $</label>
</td>
<td>
<input type="text" name="salary" value="" required="true" pattern="\d+((\.)\d{2})?"/>
</td>
</tr>
<tr>
<td>
<label for="kids">Number of children:</label>
</td>
<td>
<input type="text" name="kids" value="" required="true" pattern="[0-9]{1,}"/>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit" name="submit" value="calculate check"/>
</td>
</tr>
</table>
</form>
<?php
require_once 'CovidRelief.class.php';
if (isset($_POST['submit'])){
// get form fields
$status=$_POST['status'];
$salary=$_POST['salary'];
$kids=$_POST['kids'];
$relief=new CovidRelief($status,$salary,$kids);
$amount=$relief->calculateReliefCheck();
echo "Your check amount is: $$amount";
}
|