I have a table here fetched from SQL with
I have printed a button along with each row of SQL via PHP
output:
--------------------------------------------------------------
|----date-------| -- button(email)-- | Sno. |
------------------------------------------------------------
| 25/12/2014 | -- [some button] -- | 1. |
-----------------------------------------------------------
| 29/11/2014 | -- [some button] -- | 2. |
--------------------------------------------------------------
| 15/10/2014 | -- [some button] -- |.... and so on. |
--------------------------------------------------------------
So, here is my code for the above table:
$result = mysqli_query($con,"select date_format(cmpstartdatetime, '%d/%m/%Y') as
campdate,cmpname from Campaigns group by campdate order by campdate DESC");
//echo $result;
$datesappend = "";
if(mysqli_num_rows($result)>0){
echo "<br/><table id='example1' class='table table-bordered table-striped display'>";
echo "<thead>
<tr>
<th># </th>
<th>Campaign Date</th>
<th>Email Report</th>
</tr>
</thead>
<tbody>";
//echo "<th><td>Total Mesages</td><td>Delivered</td></th>";
$i=1;
while($row = mysqli_fetch_array($result)) {
$datesappend.=$row;
echo "<tr>";
echo "<td>".$row['campdate']."</td>";
echo "<td> <input type='button' text='venkatesh' value='Email' name='testmesssage'
id='testmesssage' class='btn btn-primary'/></td>";
echo "<td>".$i."</td>";
$i++;
echo "</tr>";
}
echo "</tbody></table>";
}
else{
echo "No campaign was done so far.";
}
}
What I need is every row has a button it has to get the content of that row if a button is pressed need to get date assigned to a variable.
actually the whole functionality is send mails by buttons. That dates related reports have to sent via mails an I have the reports.
I need to fetch data of the same row when the respective button is clicked.