Skip to main content

Send PHP variable to bootstrap modal popup via Ajax

Send PHP variable to bootstrap modal popup via Ajax

Today, We want to share with you Send PHP variable to bootstrap modal popup via Ajax.
In this post we will show you Send PHP variable to bootstrap modal popup via Ajax, hear for Send PHP variable to bootstrap modal popup via Ajax we will give you demo and example for implement.
In this post, we will learn about Send PHP variable to bootstrap modal popup via Ajax with an example.

Hello friends, in this POST we will see How to Show all the Dynamic MySQL Data display on table in Bootstrap Modal edit records. using Bootstrap Modal with Dynamic MySQL Data using Ajax & PHP

i will show in my this post how you can easily all data display/show mysql data in bootstrap modal in your table and the mysql rows are all displayed dynamically in modal via ajax call and edit and delete popup modal for used to Send PHP variable to bootstrap modal popup via Ajax

Also Read :  Facebook Graph API Search Multiple Parameters Queries

Code for index.php

<div class="panel-body">
		<table cellpadding="0" cellspacing="0" border="0" id="example">
					<th>Product Name</th>
					<th>SIM Code</th>
				$sql_content="select * from product_master where status=0";
					<td><?php echo $i;?></td>
						echo $content['product_name'];
					<td style="background:<?php echo $content['colorcode'];?>;"><?php 
						echo $content['colorcode'];
					<td class="center">
						<a href="#myModal" data-toggle="modal" data-target="#modalMyformData" data-id="<?php echo $content['product_id']; ?>" class="btn btn-primary btn-xs"><i class="glyphicon glyphicon-pencil"></i></a>
						<a href="product_mst.php?did=<?php echo $content['product_id']; ?>"  onclick="return confirm('Are you sure?')" class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-remove"></i></a>

<!-- Edit Modal -->
<div class="modal fade" id="modalMyformData" tabindex="-1" role="dialog" 
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <!-- Modal Header -->
            <div class="modal-header">
                <button type="button" class="close" 
                       <span aria-hidden="true">×</span>
                       <span class="sr-only">Close</span>
                <h4 class="modal-title" id="myModalLabel">
                    Edit Products
            <!-- Modal Body -->
            <div class="modal-body">
                <div class="fetched-data"></div> 
<!-- End Modal Footer -->

Code for Script-main.js

    $('#modalMyformData').on('', function (e) {
        var rowid = $(e.relatedTarget).data('id');
            type : 'post',
            url : 'fetch_data_records.php', //Here you will fetch records 
            data :  'rowid='+ rowid, //Pass $id
            success : function(data){
            $('.fetched-data').html(data);//Show fetched data from database

Code for : fetch_data_records.php

 <?php include 'include/config.php';
if($_REQUEST['rowid']) {
    $con_id = $_REQUEST['rowid']; //escape string 
	$sql_content1="select * from productmst where amenities_id='$con_id'";
	echo "<form method='POST'>
                  <div class='form-group'>
                    <label for='exampleInputEmail1'>Product Name</label>
                      <input type='text' class='form-control'
                      id='exampleInputEmail1' name='amname' value='".$content_data['amenities_name']."' placeholder='Product Name'/>
				<div class='form-group'>
				  <label for='exampleInputEmail1'>sim Code</label>
				  <div class='input-group demo2'>
					  <input type='text' value='".$content_data['cms_text_color_code']."' class='form-control' name='color_code1'/>
					  <span class='input-group-addon'><i></i></span>
				  <input type='hidden' name='p_id' value='".$content_data['product_id']."'/>
                  <input type='submit'  class='btn btn-primary' name='product_update' value='Update'/>
					<button type='button' class='btn btn-default'

View Demo

Also Read :  Simple PHP Rating System with database using JavaScript

We hope you get an idea about Send PHP variable to bootstrap modal popup via Ajax
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Searches related to : Send PHP variable to bootstrap modal popup via Ajax

  • pass php variable to modal window
  • pass php variable to bootstrap modal
  • php pass data to bootstrap modal
  • send variable to bootstrap modal
  • pass id to bootstrap modal
  • pass variable to modal popup
  • pass a current $row value to bootstrap modal
  • pass value to modal php

Web Developer

Hi, I’m Web developer, PHP is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development.Any visitors of this site are free to browse our tutorials, live demos, Examples and download scripts.If you have a project that you want to get started, launch quickly, contact me. Email : [email protected]