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

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

WBOY
Release: 2016-06-06 20:23:43
Original
1305 people have browsed it

<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>
Copy after login
Copy after login

回复内容:

<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>
Copy after login
Copy after login

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>
Copy after login
Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template