Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Not able to fetch data from checkbox

So, i’m working on this real estate project, where users can add room details. Probblem is, when i check the checkbox for room one detail, i get information, but when i check the checkbox for another room (Please watch video), it does not show any information. Why?
Please watch this 20 sec video: link

 <div class=" add-list-tags fl-wrap">
          <!-- Checkboxes -->
                                    <ul class="fl-wrap filter-tags no-list-style ds-tg">
                                        <?php foreach ($action->fetchData("facilities") as $key => $value) {

                                        ?>
                                            <li>
                                                <input type="checkbox" value="<?php echo $value['id']; ?>" name="room_facilities[]">
                                                <label for="<?php echo $value['name']; ?>"> <?php echo $value['name']; ?></label>
                                            </li>
                                        <?php } ?>

                                    </ul>
       <!-- Checkboxes end -->
  </div>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

All your facilities’s checboxes have the same name "room_facilities".

You’ll need to differenciate the names to receive all of them.

 <div class=" add-list-tags fl-wrap">
    <!-- Checkboxes -->
        <ul class="fl-wrap filter-tags no-list-style ds-tg">
            <?php foreach ($action->fetchData("facilities") as $key => $value) {

            ?>
                <li>
                    <input type="checkbox" value="<?php echo $value['id']; ?>" name="<?php echo $value['name']; ?>_room_facilities[]">
                    <label for="<?php echo $value['name']; ?>"> <?php echo $value['name']; ?></label>
                </li>
            <?php } ?>

        </ul>
    <!-- Checkboxes end -->
  </div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading