提问人:Dilanka Munasinghe 提问时间:8/3/2019 最后编辑:KIKO SoftwareDilanka Munasinghe 更新时间:8/3/2019 访问量:131
while 循环中的 PHP 输入
PHP input inside a while loop
问:
我想在 while 循环中根据数据库循环一组输入。但是我无法正确定义输入名称,当使用 var_dump($_POST) 检查时,提交的 POST 为空。
<body background="images/tl.jpg">
<div id="container">
<?php include "mysql/head.php" ?>
<div id="main">
<p align="left"> Your Staff ID : <?php echo $_SESSION['u_username'] ?></p>
<p align="left"> Your E-Mail : <?php echo $_SESSION['u_acemail']; ?></p>
<form id="sub-form" action="mysql/save_result.php/">
<center>
<table align="center" width=80% border="2" cellpadding="1" cellspacing="1">
<tr>
<th>Student Index No</th>
<th>Result</th>
<?php
include "mysql/dbconnect.php";
$batchno = $_POST['batch'] ;
$year = $_POST['y'];
$semester = $_POST['s'];
$tname = $batchno."_".$year."_".$semester;
$subcode = $_POST['subject'];
$_SESSION['batchno'] = $_POST['batch'];
$_SESSION['year'] = $_POST['y'];
$_SESSION['semester'] = $_POST['s'];
$_SESSION['tname'] = $batchno."_".$year."_".$semester;
$_SESSION['subcode'] = $_POST['subject'];
echo "Results Table Name : ".$tname;
echo "<br><br>";
echo "<b>Subject Code : ".$subcode."   Batch : ".$batchno."   Year : ".$year."   Semester : ".$semester."</b><br>";
$sql = "SELECT stindex,id FROM $tname WHERE stindex NOT LIKE '%stindex%' ORDER BY id;";
$result = mysqli_query($conn, $sql);
$check = mysqli_num_rows($result);
while ($row=mysqli_fetch_assoc($result)) {
$resultid = "result_".$row['id'];
echo "<tr><td align='center'>".$row['stindex']."</td><td align='center'><input type='text' name='$resultid'>".$resultid."</td></tr>";
}
echo "</table><br>";
echo "<b>Number of Rows Fetched : ".$check."</b><br><br>";
?>
提交结果 `
答: 暂无答案
下一个:其他会话工作时不显示会话消息
评论