Home > Net >  Bootstrap - Open off-canvas with GET Request PHP
Bootstrap - Open off-canvas with GET Request PHP

Time:12-31

Hi I am working on a project that use bootstrap. I have edit button and that button sends a get request. What I want to do is send that GET request and get it from the bootstrap off-canvas. My off-canvas opens with data-bs-target. Any help?

edit_album_item is the page where off-canvas included

My main page:

<?php include "includes/edit_album_item.php" ?>

                <div  style="margin-top: 20px;">
                    <div >
                        <div  style="position: absolute;">
                            <div >
                                <a href="index.php?delete=<?php echo $item_id ?>"><button ><i ></i></button></a>
                            </div>
                            <div >
                                <a href="index.php?edit=<?php echo $item_id ?>#offcanvasAlbum" data-bs-toggle="offcanvas" data-bs-target="#offcanvasAlbum" aria-controls="offcanvasAlbum"><button ><i ></i></button></a>
                            </div>
                        </div>
                        <img src="includes/images/<?php echo $item_image ?>"  alt="...">

                        <div >
                            <h5 ><?php echo $item_title ?></h5>
                            <p ><?php echo $item_description ?></p>
                        </div>
                    </div>
                </div>

Actually the edit_album_item.php is not well developed yet. I want send a get request and open off-canvas get the information from the get request. Thanks in advance!

Example Image

CodePudding user response:

I understand your question. To do this what you need to do is, add anchor to your edit button to send get request like this

index.php?yourreq

and try this is on the bottom of your page


if(isset($_GET['your req'])) {

     echo '
          <script>
                 $("#offcanvasAlbumItem").modal("show");
          </script>
';

}


I think now you are good to go.

  • Related