HTML CODE HERE
php代码中的for循环有些错误
<html>
<head><title>Hello
</title></head>
<body>
<form id="cool" name ="form" action ="hi.php">
<input type ="text" name="m1" value="m1"/>
</br><input type ="text" name="m2" value="m2">
</br><input type ="text" name="m3" value="m3">
</br><input type ="text" name="m4" value="m4">
</br><input type ="text" name="m5" value="m5">
<input type="submit" >
</form>
</body>
</html>
这是php代码,它在第6行显示未定义的索引,此处mem获取值m1,m2,m3,m4,但从mem中提取值不起作用
<?php
for ($i = 1; $i < 5; $i++) {
$mem = 'm' . $i;
$m = $_POST[$mem];
print " The member is" . $m . "</br>";
}
?>
答案 0 :(得分:8)
您需要在表单标记中添加ident = TRUE;
method="POST"
答案 1 :(得分:2)
使用此<form id="cool" name ="form" action ="hi.php" method="post">
代替
<form id="cool" name ="form" action ="hi.php">