mercredi 4 novembre 2015

How to implement “ show sub-checkbox” in php?

I'm using object oriented php or prep statement to bind all the list of medical test from the database, my question is on how to implement the show subcheckbox in php? If checkbox of the laboratory is clicked all sub-checkbox is shown? I think javascript doesn't work

Well here's the php code for medical test checkboxes

  <?php
    $tsql = "select medTestName from medtest";
    $tstmt = $con->prepare($tsql);
    $tstmt->execute();
    $tstmt->bind_result($mtn);
    $tstmt->store_result();

    while ($tstmt->fetch()){
    $d1= '<input type="checkbox" name="test[]"
     value="'.$mtn.'">'.$mtn.'<br>';
    echo $d1;
    }       

    ?>

Here's the code for sub-checkboxes

<div><input type="checkbox" name="topic" value="1"><span>Complete Blood Count</span></div>
<div><input type="checkbox" name="topic" value="2"><span>Blood Typing</span></div>
<div><input type="checkbox" name="topic" value="3"><span>Urinalysis</span></div>
<div><input type="checkbox" name="topic" value="4"><span>RPR/TPHA</span></div>
<div><input type="checkbox" name="topic" value="5"><span>Hepatitis B screening</span></div>
<div><input type="checkbox" name="topic" value="6"><span>Fasting Blood Sugar</span></div>
<div><input type="checkbox" name="topic" value="7"><span>Creatinine</span></div>
<div><input type="checkbox" name="topic" value="8"><span>Total Cholesterol(Low Cholesterol, High Cholesterol)</span></div>
<div><input type="checkbox" name="topic" value="9"><span>Triglyceride</span></div>
<div><input type="checkbox" name="topic" value="10"><span>VLDL</span></div>
<div><input type="checkbox" name="topic" value="11"><span>Blood Uric Acid</span></div>
<div><input type="checkbox" name="topic" value="12"><span>Anti-HAV Igm Screening</span></div>
<div><input type="checkbox" name="topic" value="13"><span>Anti HBaAg</span></div>
<div><input type="checkbox" name="topic" value="14"><span>Drug & Alcohol Test</span></div>
<div><input type="checkbox" name="topic" value="15"><span>Stool Culture</span></div>

Here's what my medical test looks like

enter image description here

Here's what my database for medical test

enter image description here

Sorry for the long post, I really don't know what to do really :(

Aucun commentaire:

Enregistrer un commentaire