Load Dynamic Content Bootstrap Modal PopUp-Ajax Php Mysql

In this tutorial you will see the dynamic bootstrap modal popup loading dynamic content through MYSQL database.

First create a table named Post in your MYSQL database and add these fields:-

  • id
  • post_title
  • created_date
  • author_name
  • description

and then add some records in the table.

Now We need to create three php files to get dynamic bootstrap modal:-

  1. config.php -In this file we will write the code to make connection with the database.
  2. modal.php – In this file we will write a code to show the post title and view more button which triggers the dynamic modal popup.
  3. ajax.php – This file will receive a unique id when user clicks on any post’s view more button and using that id we will fetch the content from database related to that post and send the content to modal.php file to show that content in the modal body.

Config.php

Modal.php

Ajax.php

 

4 thoughts on “Load Dynamic Content Bootstrap Modal PopUp-Ajax Php Mysql

  1. Emiley nathan

    Thank you for sharing such a simple code . It saved my lot of time.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *