【发布时间】:2015-05-26 05:30:33
【问题描述】:
如何从 PHP 循环内的 HTML 表单中发布变量值。
到目前为止我写的一段代码如下:
while($row=oci_fetch_array($sql))
{
echo "
<body>
<fieldset style=\" box-shadow: 1px 1px 10px 1px #C4C4C4;
border:0;
width:420px;
height:125px;\">
<form action=\"buffer.php\" method=\"POST\">
<strong>Code:</strong> <input type=\" text\" value=\" $row[0]\" name=\" code\" disabled ><br>
<strong>Course Name:</strong> <input type=\" text\" value=\" $row[1]\" name=\" namec\" disabled><br>
<strong>Credit:</strong> <input type=\" text\" value=\" $row[2]\" name=\" credit\" disabled ><br>
<strong>Section:</strong> <input type=\" text\" value=\" $row[3]\" name=\" section\"disabled ><br>
<input type=\"submit\" value=\"Add Assesment \" name=\"addasmnt\"><input type=\"submit\" value=\"Edit Attendance \" name=\"editasgmnt\">
</br> </fieldset> </form> </body>
";
$i=$i+1;
}
在'buffer.php'中;
<?php
session_start();
$roll= $_SESSION['roll'];
print_r($_SESSION);echo "<br>";
print_r($_POST);echo "<br>";
print_r($_GET);echo "<br>";
print_r($_REQUEST);
?>
buffer.php的输出是
Array ( [roll] => hammad.hassan )
Array ( [addasmnt] => Add Assesment )
Array ( )
Array ( [addasmnt] => Add Assesment )
$_POST 没有显示任何变量。
【问题讨论】:
-
你是说提交后
$_POST是空的吗?