<code><html>
<head><title>成绩</title></head>
<body>
<form method="post" action="4.2.php">
小明:<input type="text" name="C[]"><br/>
小红:<input type="text" name="C[]"><br/>
小白:<input type="text" name="C[]"><br/>
小李:<input type="text" name="C[]"><br/>
小兰:<input type="text" name="C[]"><br/>
<input type="submit" name="postmethod" value="提交">
</form>
</body>
</html>
<?php
if(isset($_POST['postmethod']))
{
$CJ=$_POST['C'];
echo"接收的成绩:<br/>";
} else {
echo "Nothing";
}
?>
</code><code><html>
<head><title>成绩</title></head>
<body>
<form method="post" action="4.2.php">
小明:<input type="text" name="C[]"><br/>
小红:<input type="text" name="C[]"><br/>
小白:<input type="text" name="C[]"><br/>
小李:<input type="text" name="C[]"><br/>
小兰:<input type="text" name="C[]"><br/>
<input type="submit" name="postmethod" value="提交">
</form>
</body>
</html>
<?php
if(isset($_POST['postmethod']))
{
$CJ=$_POST['C'];
echo"接收的成绩:<br/>";
} else {
echo "Nothing";
}
?>
</code>
echo '
';<br>print_r($cj);</p>
<p class="answer fmt" data-id="1020000004091116">
<pre class="brush:php;toolbar:false;"><code>for($i=0; $i<count($CJ); $i++){
echo $CJ[$i] . "/n";
}</code>另外,建议name值改为
<code>C[]['xm'],C[]['xh']...</code>
起码知道value所属key
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号