Why “php code” change in a bootstrap modal box?

Hi When I use boostrap modal box ; Than php code takes only the first item of my table…;

$sonuc[‘proje_ismi’] is working normal in button and change everyline as database:

But when I put it on bootstarp modal box, it only takes the first item. Why is that?

And how can I solve it with a simple way?

Thanks for advices.

<td> 

  <button type="button" id="view_files" name="view_files" data-name="'.$proje_ismi.'"  data-toggle="modal" data-target="#myModal" class="view_files btn btn-default btn-sm"><font  size="2" >
                <?php echo $sonuc['proje_ismi'] ?></font></button>

  <div class="modal fade" id="myModal" >

  <div class="modal-header">
  <button type="button" class="close" data-dismiss="modal">&times;</button>
  <h4 class="modal-title">Proje Dosyaları</h4>
  </div>
  <div class="modal-body">


  <table class="table table-bordered table-striped">
  <tr>
  <th>Dosya İsimleri </th>
  </tr>
  <tr>

  <th>
  <div class="modal-body" id="file_list">
  <?php   
  $projeler =  $sonuc['proje_ismi'] ;
  echo $projeler;

  $folder = array_filter(glob(''.$projeler.'/*.*'));




  print_r($folder);
  ?>

</th>
  </tr>
  </table>  


  </div>
  <div class="modal-footer">
  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  </div>
  </div>
  </div>
                </td>

Looks like you should be echoing that out.

First of all proje_ismi = project_ name in my language.

until modal box I get right solution in my big table each line gives different project_names.

for example in first button :

<button type="button" id="view_files" name="view_files" data-name="'.$proje_ismi.'"  data-toggle="modal" data-target="#myModal" class="view_files btn btn-default btn-sm"><font  size="2" >
                <?php echo $sonuc['proje_ismi'] ?></font></button>

but after start Bootstrap modal box it only give me the first project name in each line…

if code become like that:
There becomes right solution and I can see all files in each of my project names in each line

<td> 

  <button type="button" id="view_files" name="view_files" data-name="'.$proje_ismi.'"  data-toggle="modal" data-target="#myModal" class="view_files btn btn-default btn-sm"><font  size="2" >
                <?php echo $sonuc['proje_ismi'] ?></font></button>

  
  <table class="table table-bordered table-striped">
  <tr>
  <th>Dosya İsimleri </th>
  </tr>
  <tr>

  <th>
  <div class="modal-body" id="file_list">
  <?php   
  $projeler =  $sonuc['proje_ismi'] ;
  echo $projeler;

  $folder = array_filter(glob(''.$projeler.'/*.*'));




  print_r($folder);
  ?>

</th>
  </tr>
  </table>  


                </td>

You can’t use a PHP variable in the HTML like this. You need to echo it using PHP.

yes I know it… but it is nothing about our code… I already delete it.

<button type="button" data-toggle="modal" data-target="#myModal" class="view_files btn btn-default btn-sm"><font size="2" > <?php echo $sonuc['proje_ismi'] ?></font></button>

I see nothing in the code you have provided that shows a loop?

1 Like

What you mean ?

I really very close to get crazy… why bootstarp doesnt get the “php loop code” and stop in the first line
outside of bootstrap modal box code is working as I want…SSSS :(((((((

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.