• February 17, 2023
    <!DOCTYPE html>
    <html>
    <head>
    	<title>Health Care Costs Calculator</title>
    	<style>
    		table, th, td {
    		  border: 1px solid black;
    		  border-collapse: collapse;
    		}
    		th, td {
    		  padding: 5px;
    		}
    		th {
    		  text-align: left;
    		}
    	</style>
    </head>
    <body>
    	<form action="" method="post">
    		<label for="gender">Gender:</label>
    		<select id="gender" name="gender">
    			<option value="male">Male</option>
    			<option value="female">Female</option>
    		</select>
    		<br><br>
    		<label for="age">Age:</label>
    		<select id="age" name="age">
    			<option value="age1">18-34</option>
    			<option value="age2">35-44</option>
    			<option value="age3">45-54</option>
    			<option value="age4">55-64</option>
    			<option value="age5">65+</option>
    		</select>
    		<br><br>
    		<input type="submit" name="submit" value="Calculate">
    	</form>
    	<br>
    
    <?php
    if(isset($_POST['submit'])){
        $gender = $_POST['gender'];
        $age = $_POST['age'];
        $hc = array(1000, 2000, 2500, 3000, 4000, 5000);
        $life = array(100000, 100000, 500000, 750000, 1000000, 3000000);
        $lifep = array(10000, 10000, 50000, 75000, 100000, 300000);
        $costs = array(
            "male" => array(
                "age1" => array(100, 200, 250, 300, 400, 500),
                "age2" => array(110, 220, 275, 330, 440, 550),
                "age3" => array(130, 260, 325, 390, 520, 650),
                "age4" => array(150, 300, 375, 450, 520, 750),
                "age5" => array(200, 400, 500, 600, 800, 1000)
            ),
            "female" => array(
                "age1" => array(20, 40, 50, 60, 80, 100),
                "age2" => array(24, 48, 60, 72, 96, 120),
                "age3" => array(40, 80, 100, 120, 160, 200),
                "age4" => array(150, 300, 375, 450, 520, 750),
                "age5" => array(200, 400, 500, 600, 800, 1000)
            )
        );
        $total_cost = $costs[$gender][$age];
        echo "<table>";
        echo "<tr><th>Health Care Costs for $gender ($age) and hc and life and lifep:</th></tr>";
        for ($i=0; $i < count($hc); $i++) { 
            echo "<tr><td>$" . $total_cost[$i] . " hc " . $hc[$i] . " life " . $life[$i] . " lifep " . $lifep[$i] . "</td></tr>";
        }
        echo "</table>";
    }
    ?>
    


เวอไนน์ไอคอร์ส

ประหยัดเวลากว่า 100 เท่า!






เวอไนน์เว็บไซต์⚡️
สร้างเว็บไซต์ ดูแลเว็บไซต์

Categories


Uncategorized