Home >Backend Development >PHP Tutorial >post接收不到成绩,按纵行显示?

post接收不到成绩,按纵行显示?

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

<code>
<title>成绩</title>

<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>


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

回复内容:

<code>
<title>成绩</title>

<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>


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

echo '

';<br>print_r($CJ);
                            
            <p class="answer fmt" data-id="1020000004091116">
                                    
</p><pre class="brush:php;toolbar:false"><code>for($i=0; $i<count echo .></count></code>

另外,建议name值改为

<code>C[]['xm'],C[]['xh']...</code>

起码知道value所属key

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