0

I need a help here.

I have an application - it queries some data from MySQL and present it in table (index.php file). Every row is a single customer record. What I want to do is, when I click on the row, it opens customer record (customer.php file).

I tried the following code - when I click on the row, modal with remote page(customer.php only flashes, and then customer.php is loaded normally. I dont know why... does any body have an idea?

<table class="table table-hover container table-responsive">
        <caption>Vyhledaní zákazníci</caption>
        <thead>
          <tr>
            <th>Jméno</th>
            <th>Příjmení</th>
            <th>Email</th>
            <th>Telefon</th>
            <th>Adresa</th>
            <th>Město</th>
            <th>Akce</th>
          </tr>
        </thead>
        <tbody>

    <?php

        while ($results = mysql_fetch_array($customers)) { ?>
          <tr class="clickableRow active" href="customer.php?customerId=<?php echo $results['id'], '&search=', Input::get('search'); ?>" data-toggle="modal" data-target="#customerModal">
            <td><?php echo $results['first_name']; ?> </td>
            <td><?php echo $results['last_name']; ?> </td>
            <td><?php echo $results['email']; ?> </td>
            <td><?php echo $results['telephone']; ?> </td>
            <td><?php echo $results['street']; ?> </td>
            <td><?php echo $results['city']; ?> </td>
            <td><a href="list.php?customerId=<?php echo $results['id'], '&search=', Input::get('search'); ?>" class="btn btn-success">Seznam zakázek</a>
              <a href="new-order.php?customerId=<?php echo $results['id'], '&search=', Input::get('search'); ?>" class="btn btn-warning">Nová zakázka</a>
          </tr>
       <?php 
     } ?>

        </tbody>
      </table>

And modal:

<!-- Modal -->
<div class="modal fade" id="customerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
             <h4 class="modal-title">Karta zákazníka</h4>

        </div>
        <div class="modal-body"><div class="te"></div></div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary">Save changes</button>
        </div>
    </div>
    <!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->

Insane Skull
  • 9,220
  • 9
  • 44
  • 63
HyperT
  • 23
  • 6
  • On click on those rows you need to do an ajax query to a php page. The result can be loaded inside a modal – Marco Mura Dec 09 '14 at 15:34
  • you have to refresh your modal content as it's explained here :http://stackoverflow.com/questions/12286332/twitter-bootstrap-remote-modal-shows-same-content-everytime – scraaappy Dec 09 '14 at 17:04
  • @both: Well, just to more explain what is going on: http://youtu.be/rhSv3H5LVqw. So, data is OK, but modal flashes and then disappears – HyperT Dec 09 '14 at 21:40

0 Answers0