2
我有一些text input
,编辑这样一些主题的价值:输入文本类型到数组只有最后一排
while($row = mysql_fetch_row($result2))
{
echo "<tr><td>" . $row['ID'] . "</td><td>" . $row['Name'] . "</td><td>" . $row['Status'] .
"</td><td><input type=\"text\" size=\"4\" id=\"editmath[]\" name=\"editwater\" value=" . $row['math'] . ">
</td><td><input type=\"text\" size=\"4\" id=\"editeng[]\" name=\"editfod\" value=" . $row['english'] . ">
</td><td><input type=\"text\" size=\"4\" id=\"editscie[]\" name=\"editmob\" value=" . $row['science'] . ">
}
<Input type="Submit" value=" Next " name="submit_edit">
而在PHP我有这样的代码:
if (isset($_GET['submit_edit'])) {
$math[] = $_GET['editmath'];
$eng[] = $_GET['editeng'];
$scie[] = $_GET['editscie'];
sql = "UPDATE student SET math = $math, english = $eng, science = $scie";
$query = mysql_query($sql);
}
但是,当我尝试print_r
math
和eng
,它们只保存最后一行。如何解决这个问题呢?
Desired Output :
Math English Science
4 3 2
7 8 10
3 5 12
'name'应在'阵列()''未id'。您需要更改代码。 – Yash