File "modal_api.php"

Full path: /home/fsibplc/public_html/fsib/modal_api.php
File size: 5.59 B (5.59 KB bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php
    if(isset($_POST["modal_id"]))
    {
        $output = '';

        include('admin/config/dbcon.php');

     //   $conn = new mysqli('localhost','root','','fsib_db');

     $stmt = $conn->prepare("select br_name from location where id = ?");
     $stmt->bind_param("s", $_POST["modal_id"]); 
     $stmt->execute();
     $result = $stmt->get_result();
 

       // $find_sql = "select br_name from location where id = ".$_POST["modal_id"];
       // $result = $conn->query($find_sql);

        $output .='
        <div class="modal-header">';

        while($rows=$result->fetch_assoc()){ 
            $output .='
                    <h5 class="modal-title" id="myModalLabel">'.$rows['br_name'].'</h5>';
        }
              $output .='<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="details_modal">
                        <div class="map">';

                        $stmt = $conn->prepare("select lattitude, longitude from location where id = ?");
                        $stmt->bind_param("i", $_POST["modal_id"]); 
                        $stmt->execute();
                        $result = $stmt->get_result();
                    


                       //  $find_sql = "select lattitude,longitude from location where id = ".$_POST["modal_id"];
                       //  $result = $conn->query($find_sql);
                         
                         $output .='<iframe style="width:100%;height:100%;" frameborder="0" scrolling="no" marginheight="0"
                                marginwidth="0"';
                                while($rows=$result->fetch_assoc()){ 
                               $output .=' src="https://maps.google.com/maps?q='.$rows['lattitude'].','.$rows['longitude'].'&hl=en&z=14&amp;output=embed">';
                                }
                            $output .='</iframe>
                        </div>
                        <div class="info">
                            <table class="table table-bordered table-striped"
                                style="width:100%;font-size: 13px;height:100%;">

                                <tbody>';
                                

                                $find_sql = "select * from location where id = ?";
                                $stmt = $conn->prepare($find_sql);
                                $stmt->bind_param("s", $_POST["modal_id"]); // Assuming modal_id is a string. Use "i" for integer.
                                $stmt->execute();
                                $result = $stmt->get_result();
                                
                             //   $find_sql = "select * from location where id = ".$_POST["modal_id"];
                              //  $result = $conn->query($find_sql);
                                
                                
                                
                                while($rows=$result->fetch_assoc()){
                                    $output .='<tr>
                                        <th width="40%">Branch Code</th>
                                        <td width="60%">'.$rows["br_code"].'</td>
                                    </tr>
                                    <tr>
                                        <th width="40%">Branch Name</th>
                                        <td width="60%">'.$rows["br_name"].'</td>
                                    </tr>
                                    <tr>
                                        <th width="40%">Branch Address</th>
                                        <td width="60%">'.$rows["br_address"].'</td>
                                    </tr>
                                    <tr>
                                        <th width="40%">Zone</th>
                                        <td width="60%">'.$rows["zone_name"].'</td>
                                    </tr>

                                    <tr>
                                        <th width="40%">Phone</th>
                                        <td width="60%"><strong>Manager :</strong> '.$rows["br_manager"].'<br>
                                            <strong>Man. Op :</strong> '.$rows["man_opration"].'
                                        </td>
                                    </tr>
                                    <tr>
                                        <th width="40%">Email</th>
                                        <td width="60%">'.$rows["email"].'</td>
                                    </tr>
                                    <tr>
                                        <th width="40%">Routing No.</th>
                                        <td width="60%">'.$rows["routing_no"].'</td>
                                    </tr>
                                    <tr>
                                        <th width="40%">Phone No.</th>
                                        <td width="60%">'.$rows["phone_no"].'</td>
                                    </tr>
                                    <tr>
                                        <th width="40%">FAX</th>
                                        <td width="60%">'.$rows["fax"].'</td>
                                    </tr>';
                                }
                                $output .='</tbody>
                            </table>
                        </div>
                    </div>
                </div>';

                echo $output;

    }
?>