单击“删除”按钮时,将我重定向到PHP中的“更新”页面

时间:2018-03-30 16:58:15

标签: php e-commerce

 echo "<a href='categories.php?do=Edit&catid=" . $cat['ID'] ."' class='btn btn-xs btn-primary'><i class='fa fa-edit'></i> Edit </a>";
                echo "<a href='categories.php?do=Delete&catid=" . $cat['ID'] . "' class='btn btn-xs btn-danger confirm'><i class='fa fa-close'></i> Delete </a>";

当我点击删除按钮时,它会打开更新页面而不是删除页面 虽然href是:categories.php?do = Delete&amp; catid =

删除页面的代码是:

//Delete Member Page
echo "<h1 class='text-center'>Delete Category</h1>";
echo "<div class='container'>";

$catid = isset($_GET['catid']) && is_numeric($_GET['catid']) ? intval ($_GET['catid']) : 0;

$check = checkItem('ID', 'cato', $catid);


  if($check > 0 ) {

    $stmt = $con->prepare("DELETE FROM cato WHERE ID = :zid");

    $stmt->bindParam(":zid", $catid);

    $stmt->execute();

    $theMsg = "<div class='alert alert-success'>Done</div>";

    redirectHome($theMsg);

  }else {

    $theMsg = "<div class='alert alert-danger'>Sorry You Cannot Delete It</div>";

    redirectHome($theMsg);
  }

  echo "</div>";

0 个答案:

没有答案