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