• March 1, 2023
    <?php
    // define the premium values for males and females
    $male_premiums = array(
        18 => 100,
        25 => 200,
        40 => 300,
        60 => 400
    );
    
    $female_premiums = array(
        18 => 80,
        25 => 150,
        40 => 250,
        60 => 350
    );
    
    // get the user's age and sex from the form
    $age = $_POST['age'];
    $sex = $_POST['sex'];
    
    // check if the user wants to multiply the premium values
    if (isset($_POST['multiply']) && $_POST['multiply'] == 'on') {
        $factor = 2;
    } else {
        $factor = 1;
    }
    
    // display the premium tables
    echo '<h2>Male Premiums:</h2>';
    echo '<table>';
    echo '<tr><th>Age</th><th>Premium</th></tr>';
    foreach ($male_premiums as $a => $p) {
        $p = $p * $factor;
        echo '<tr><td>' . $a . '</td><td>' . $p . '</td></tr>';
    }
    echo '</table>';
    
    echo '<h2>Female Premiums:</h2>';
    echo '<table>';
    echo '<tr><th>Age</th><th>Premium</th></tr>';
    foreach ($female_premiums as $a => $p) {
        $p = $p * $factor;
        echo '<tr><td>' . $a . '</td><td>' . $p . '</td></tr>';
    }
    echo '</table>';
    ?>
    
    <form method="post">
        <label for="age">Age:</label>
        <select id="age" name="age">
            <option value="18">18</option>
            <option value="25">25</option>
            <option value="40">40</option>
            <option value="60">60</option>
        </select>
        <br>
        <label for="sex">Sex:</label>
        <select id="sex" name="sex">
            <option value="male">Male</option>
            <option value="female">Female</option>
        </select>
        <br>
        <label for="multiply">Multiply premium values:</label>
        <input type="checkbox" id="multiply" name="multiply">
        <br>
        <input type="submit" value="Compare premiums">
    </form>
    


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

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






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

Categories


Uncategorized