I have the following: A php foreach loop that fetches info and displays it in a table. What I want to do is then make my Client Code row clickable so that it will open a modal contain the info of that client linked to that client code.
Issue 1: How do I actually make the client code in my table clickable. My loop looks like this
foreach ($results as $rows)
{
echo
"<tr>
<td>" . $rows['Client_Code'] . "</td>
<td>" . $rows['firstname'] . "</td>
<td>" . $rows['lastname'] . "</td>
<td>" . $rows['Service_Name'] . "</td>
<td>" . $rows['Physical_Address'] . "</td>
<td>" . $rows['Cell'] . "</td>
<td>" . $rows['billingemail'] . "</td>
<td>" . $rows['Business_Name'] . "</td>
<td>
</tr>";
}
If I understand correctly I should do this
foreach ($results as $rows)
{
echo
"<tr>
<td><button type="button" class="btn btn-outline-success block btn-lg" data-toggle="modal" data-target="#xlarge">" . $rows['Client_Code'] . "</td></button>
<td>" . $rows['firstname'] . "</td>
<td>" . $rows['lastname'] . "</td>
<td>" . $rows['Service_Name'] . "</td>
<td>" . $rows['Physical_Address'] . "</td>
<td>" . $rows['Cell'] . "</td>
<td>" . $rows['billingemail'] . "</td>
<td>" . $rows['Business_Name'] . "</td>
<td>
</tr>";
}
?>
This however gives me an error: Parse error: syntax error, unexpected 'button' (T_STRING), expecting ',' or ';'
and also my editor does not like it
Issue 2: How do select the php data for that user to be used in my modal?
Your help would be appretiated
Thanks