我在HTML上有此php代码
<?php
$i=1;
$sql = "SELECT * FROM redudant_barat";
$query = mysqli_query($db, $sql);
while($redudant_barat = mysqli_fetch_array($query)){
echo "<tr class='even pointer'>";
echo "<td>$i</td>";
echo "<td>".$redudant_barat['peralatan']."</td>";
echo "<td>".$redudant_barat['down_time']."</td>";
echo "<td>".$redudant_barat['up_time']."</td>";
echo "<td>".$redudant_barat['errortime']."</td>";
echo "<td>".$redudant_barat['keterangan']."</td>";
echo "<td>";
echo "<a href='formeditredudantbarat.php?id=".$redudant_barat['id']."'>Edit</a> |";
echo "<a href='deleteredudantbarat.php?id=".$redudant_barat['id']."'>Hapus</a>";
echo "</td>";
echo "</tr>";
$i++;
}
?>
我想用此按钮代码替换<a href><a>
,此按钮显示通知并从js文件调用功能。
有什么办法可以继续吗?
<button class="btn btn-default source" onclick="new PNotify({
title: 'Regular Success',
text: 'That thing that you were trying to do worked!',
type: 'success',
styling: 'bootstrap3'
});">Success</button>
答案 0 :(得分:0)
<?php
$i=1;
$sql = "SELECT * FROM redudant_barat";
$query = mysqli_query($db, $sql);
while($redudant_barat = mysqli_fetch_array($query)){
echo "<tr class='even pointer'>";
echo "<td>$i</td>";
echo "<td>".$redudant_barat['peralatan']."</td>";
echo "<td>".$redudant_barat['down_time']."</td>";
echo "<td>".$redudant_barat['up_time']."</td>";
echo "<td>".$redudant_barat['errortime']."</td>";
echo "<td>".$redudant_barat['keterangan']."</td>";
echo "<td>";
echo '<button class="btn btn-default source" onclick="new PNotify({
title: "Regular Success",
text: "That thing that you were trying to do worked!",
type: "success",
styling: "bootstrap3"
});">Success</button> |';
echo "<a href='deleteredudantbarat.php?id=".$redudant_barat['id']."'>Hapus</a>";
echo "</td>";
echo "</tr>";
$i++;
}