如何创建从数据库获取并传递值的复选框

时间:2019-03-20 00:32:56

标签: php arraylist checkbox

我是php新手,无法将行变成复选框字段,该字段传递到单独的页面上。


if ($result = $db->query($sql) ) {


        //*start of original
        if ($result->num_rows > 0) {
            ?>
            <!-- <form action="Confirmation.php" method="post"> -->
            <form action="Payment.php" method="post">
            <label for="PatientID">Choose the Patient you wish to register for:</label>
            <select name="PatientID" id="">
                <option value="" disabled>Please select a patient to enroll:</option>
                <!-- <option value="All">All Patients</option> -->
            <?php
            while($result = fetch_assoc($result)) {

            echo "<input type='checkbox' value='{$row['PatientID']}'>" . $row['PatientName'] . '</br>';
            }


            //
            //while ($row=$result->fetch_assoc()) {
                    ?>
                    //<option value="<?=$row['PatientID'];?>">&nbsp;&nbsp;&nbsp;<?=$row['PatientName']?></option>
            //*/        <?php
            //}
            echo '</select><input type= "submit" class="myButton" name="submit" value="Register Now" /></form>';
        } else {
            echo "There are no patients currently available for registration." ;
            $rosterListFail = true;
        }
} else {
    $message = $db->error;
    // echo $message;
}
//*/
//}
?>

0 个答案:

没有答案