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