I've a table with multiple rows containing a button tag which opens a modal.
I want to pass the row id as I want to run a PHP script to select some values from a MySQL table.
Here is my button tag code:
echo "<button type=\"button\" class=\"btn btn-info btn-sm\" data
toggle=\"modal\" data-target=\"#info<?php echo $row['0'];?>\">";
echo "Info"; echo"</button>";
echo "</td>";
And below is my modal tag code:
<!-- Modal -->
<div class="modal fade" id="info<?php echo $row['0'];?>" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Replica Table </h4>
</div>
<div class="modal-body">
<p><b>Device name:</b>XYZ<br><br>
<b>Manufecturer name:</b>XYZ<br><br>
<b>Total no:</b>12<br><br>
<b>sold no:</b>12<br>
<br><br>
<table>
<tr>
<th><?php echo $row['0'] ?>;</th>
<th><?php echo $row['0'] ?></th>
<th>IP Address</th>
<th>GPS</th>
<th>SOLD/AVAILABLE</th>
<th>Status</th>
<th>key</th>
</tr>
I get the error below:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in