Home >Backend Development >PHP Tutorial >成绩显示不出来,哪里错了呢

成绩显示不出来,哪里错了呢

WBOY
WBOYOriginal
2016-06-06 20:23:431311browse

<code>
<title>数组的应用</title>

<form name="1" method="post" action="">
小明:<input type="text" name="CJ"><br>
小红:<input type="text" name="CJ"><br>
小白:<input type="text" name="CJ"><br>
小李:<input type="text" name="CJ"><br>
小兰:<input type="text" name="CJ"><br>
<input type="submit" name="postmethod" value="提交">
</form>


<?php if(isset($_POST['postmethod']))
{
     $CJ=$_POST['CJ'];
     echo"<br>接收的成绩:<br>";
   
}
?></code>

回复内容:

<code>
<title>数组的应用</title>

<form name="1" method="post" action="">
小明:<input type="text" name="CJ"><br>
小红:<input type="text" name="CJ"><br>
小白:<input type="text" name="CJ"><br>
小李:<input type="text" name="CJ"><br>
小兰:<input type="text" name="CJ"><br>
<input type="submit" name="postmethod" value="提交">
</form>


<?php if(isset($_POST['postmethod']))
{
     $CJ=$_POST['CJ'];
     echo"<br>接收的成绩:<br>";
   
}
?></code>

1.你的本意是要把所有输入放在一个数组,所以应该是这样的name="CJ[]",还有建议命名用英文,可读性比较高
2.你应该打印出来。

<code>
<meta charset="utf8">
<title>数组的应用</title>

<form method="post" action="get.php">
小明:<input type="text" name="CJ[]"><br>
小红:<input type="text" name="CJ[]"><br>
小白:<input type="text" name="CJ[]"><br>
小李:<input type="text" name="CJ[]"><br>
小兰:<input type="text" name="CJ[]"><br>
<input type="submit" name="postmethod" value="提交">
</form>

</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn