链接不重定向到另一个页面

时间:2015-04-14 10:59:47

标签: php html mysql sql mysqli

我有一个表格,其中一列用于编辑按钮,其代码为

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>

3 个答案:

答案 0 :(得分:0)

试试这个:

echo '<td><a href="/a_add_fav_vendor.php?id="'.$data['id'].'"><input type="image" src="images/icn_edit.png" title="Edit"></a></td>';

答案 1 :(得分:0)

做一些改变,比如

echo "<td><a href='a_add_fav_vendor.php?id=".$data['id']."'><input type='image' src='images/icn_edit.png' title='Edit'></a></td> ";

答案 2 :(得分:0)

如果您的<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>
";