我有一个表,其中一列用于编辑按钮,它的代码是
echo "<td><a href=\"a_add_fav_vendor.php?id=".$data['id']."\"><input type='image' src='images/icn_edit.png' title='Edit'></a></td> ";
不知道为什么链接打不开了。谁能告诉我这是怎么回事
整个表的代码是
<form method="post" action="sendmail.php">
<div class="tab_container">
<div id="tab1" class="tab_content">
<?php
$reload = $_SERVER['PHP_SELF'] . "?tpages=" . $tpages;
echo "<table class='tablesorter' cellspacing='0'> ";
echo "<thead>
<tr>
<th></th>
<th></th>
<th>Shopname</th>
<th>Instagram account</th>
<th>Favourite</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>";
for ($i = $start; $i < $end; $i++)
{
if ($i == $total_results)
{
break;
}
mysqli_data_seek($result, $i);
$data = mysqli_fetch_assoc($result);
echo "<tr " . $cls . ">";
echo '<td></td>';
?><td> <input name="checkbox[<?php echo $data['id']?>]" type="checkbox"> </td>
<?
echo '<td>' . $data['fullname_shopname'] . '</td>';
echo '<td>' . $data['username_instagramacnt'] . '</td>';
if($data['staffpick']=='yes')
{
echo '<td>Yes</td>';
}
else
{
echo '<td>No</td>';
}
echo "<td><a href=\"a_add_fav_vendor.php?id=".$data['id']."\"><input type='image' src='images/icn_edit.png' title='Edit'></a></td> ";
echo "<td><a onclick=\"return confirm('delete this record?')\" href=\"a_del_vendor.php?id=".$data['id']."\" ><input type='image' src='images/icn_trash.png' title='Trash'></a></td> ";
echo "</tr>";
}
echo "</table>";
echo '<div class="pagination" style="margin-left:300px;" >';
if ($total_pages > 1)
{
echo paginate($reload, $show_page, $total_pages);
}
echo "</ul>
</div>";
?>
</div>
</div>
<footer>
<div class="submit_link">
<input type="submit" value="Send Mail" name="submit" class="alt_btn">
</div>
</footer>
</form>
最佳答案
如果您的 <table>
包裹在 <form>
中标签。使用<img />
标签代替。使用 <input type="image" />
实际上会submit表单而不是执行链接重定向。
echo "
<td>
<a href=\"a_add_fav_vendor.php?id=".$data['id']."\">
<img src=\"images/icn_edit.png\" title=\"Edit\"
</a>
</td>
";
关于php - 链接不重定向到另一个页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29625648/