Quote:
Originally Posted by emnieysh
for example :
i have 2 student
Hasanah TT074921 5(marks)
Syakirah TT074318 4(marks)
*marks was a textbox fill..went i insert mark n submit it,
only Syakirah TT074318 4 was insert into db..so how should i do to insert HASANAH n SYAKIRAH record in db..
|
a few methods can be used. but easiest is to use array.
Code:
<input type="text" name="student[1]"...
<input type="text" name="mark[1]"...
<input type="text" name="student[2]"...
<input type="text" name="mark[2]"...
in the action script..
Code:
$student = $_POST['student'];
foreach ($_POST['mark'] AS $i => $v) {
mysql_query("INSERT INTO table VALUES ('%s', %d)", $student[$i], $v);
}
btw, fine=elok/baik, find=jumpa/cari...