【发布时间】:2019-03-17 17:04:13
【问题描述】:
您好,我有这个删除功能,但我还没有设置任何功能,因为我想删除数据并在同一页面中重定向,但我不知道我是如何尝试研究的,但它不起作用.在此页面中,显示的所有信息都从一个页面发送到此页面,以便用户查看日程安排,然后可以选择删除它,但我不知道如何删除数据并重定向到同一页面而不会弄乱向上显示的其他数据..我尝试使用 header(location:) 函数但是当我重定向显示的数据时没有显示,因为我在重定向时没有传递任何值需要帮助,这是我的代码
if ($teacher<>""){
$query1 = mysqli_query($conn," SELECT * from schedule natural join instructor where day ='t' and schedule.instructorID ='$teacher' and timeID ='$id' and grade = '$grade' and semester = '$semester'");
}
elseif ($room<>""){
$query1 = mysqli_query($conn,"SELECT * from schedule natural join instructor where day = 't' and schedule.room = '$room' and timeID ='$id' and grade = '$grade' and semester = '$semester'");
}
elseif ($strand<>""){
$query1 = mysqli_query($conn,"SELECT * from schedule natural join instructor where day = 't' and schedule.strand= '$strand' and timeID ='$id' and grade = '$grade' and semester = '$semester'");
}
$row1 = mysqli_fetch_array($query1);
$id1 = $row['scheduleID'];
$count=mysqli_num_rows($query1);
if ($count==0)//checking
{
//echo "<td></td>";
}
else
{
//print
echo "<li class='showme'>";
echo "<a href='#' id='$id1' class='delete' title='Delete'>Remove</a>";
echo $row1['subject'];
echo "</li>";
echo "<li class='$displayc'>$row1[strand]</li>";
echo "<li class='$displaym'>$row1[fname], $row1[lname]</li>";
echo "<li class='$displayr'>Room $row1[room]</li>";
echo "</ul>";
echo "</div>";
}
?>
</td>
然后我有 delete.php 但我还没有任何设置函数,因为它我只知道如何使用表单删除,但是由于上述原因,当您删除时重定向是问题
【问题讨论】:
-
在 PHP 中使用
<>是非常罕见的。把我吓了一跳。 -
请用代码解释更多
-
上面显示的代码是在用户选择一个strand、room或teacher查看时显示数据。 @gaurav
标签: javascript php mysql