Php include#uONCE后的html不';不存在
我正在制作一个users表,我正在使用一个php页面包含表的一部分(users),我使用Php include#uONCE后的html不';不存在,php,html,mysql,session,Php,Html,Mysql,Session,我正在制作一个users表,我正在使用一个php页面包含表的一部分(users),我使用include\u once调用该页面 之后,当我运行页面(使用localhost)时,include我的html不存在。代码不是隐藏的,它根本不存在 这是我的表格,包含函数: <form onsubmit="return confirm('are you sure that you want to delete this user?');" action="includes/delete_user-i
include\u once
调用该页面
之后,当我运行页面(使用localhost)时,include我的html不存在。代码不是隐藏的,它根本不存在
这是我的表格,包含函数:
<form onsubmit="return confirm('are you sure that you want to delete this user?');" action="includes/delete_user-inc.php" method="post">
<div>
<h2>All purchesed products:</h2>
</div>
<div>
<table class="pt">
<tr> <th class="t">Id</th>
<th class="t">Userame</th>
<th class="t">Email</th>
<th class="t">delete</th>
</tr>
<?php
include_once 'includes/manage_users-inc.php';
?>
</table>
</div>
</form>
<?php
require 'dbh-inc.php';
$id = $_SESSION['userId'];
if(!isset($id))
{
header("Location:../login.php");
exit();
}
$num=-1;
$sql = "SELECT idUsers, uidUsers, emailUsers FROM users;";
$result = mysqli_query($conn, $sql);
if($result->num_rows > 0){
while($row = mysqli_fetch_assoc($result)){
$num = $num +1;
echo "<tr><td>".$row['idUsers'].
"</td><td>". $row['uidUsers'].
"</td><td>". $row['emailUsers'].
"</td><td><input type=\"submit\" name=\"submit[" . $row['idUsers'] . "]\" value=\"delete user\" class=\"button\"></td></tr>" ;
}
}
exit();
?>
所有购买的产品:
身份证件
用户名
电子邮件
删除
在此点之后的任何html都不会显示在文件中
php代码:
<form onsubmit="return confirm('are you sure that you want to delete this user?');" action="includes/delete_user-inc.php" method="post">
<div>
<h2>All purchesed products:</h2>
</div>
<div>
<table class="pt">
<tr> <th class="t">Id</th>
<th class="t">Userame</th>
<th class="t">Email</th>
<th class="t">delete</th>
</tr>
<?php
include_once 'includes/manage_users-inc.php';
?>
</table>
</div>
</form>
<?php
require 'dbh-inc.php';
$id = $_SESSION['userId'];
if(!isset($id))
{
header("Location:../login.php");
exit();
}
$num=-1;
$sql = "SELECT idUsers, uidUsers, emailUsers FROM users;";
$result = mysqli_query($conn, $sql);
if($result->num_rows > 0){
while($row = mysqli_fetch_assoc($result)){
$num = $num +1;
echo "<tr><td>".$row['idUsers'].
"</td><td>". $row['uidUsers'].
"</td><td>". $row['emailUsers'].
"</td><td><input type=\"submit\" name=\"submit[" . $row['idUsers'] . "]\" value=\"delete user\" class=\"button\"></td></tr>" ;
}
}
exit();
?>
我需要做什么来修复html文件?
谢谢
更新:我错误地认为每个php脚本都必须有一个exit()函数。在包含脚本时,使用exit()函数将退出父页面,仅退出包含页面。
include将代码注入另一个页面,它不会“调用”另一个页面。摆脱
exit();
行,因为这会导致主脚本在打印其余HTML之前退出