form:
<form>
<table>
<tr>
<th>Subject</th>
<th>Description</th>
<th>Final Grade</th>
<th>Remarks</th>
</tr>
<!--
You can loop this one, depends on the subjects.
Subject must not be encoded. Baka lalagyan ng maling subject.
I just base it to your design so naging ganito.
-->
<tr>
<td><input type="text" name="grades[][subject]" id="grades[][subject]" value="" /></td>
<td><input type="text" name="grades[][description]" id="grades[][description]" value="" /></td>
<td><input type="text" name="grades[][grade]" id="grades[][grade]" value="" /></td>
<td><input type="text" name="grades[][remark]" id="grades[][remark]" value="" /></td>
</tr>
<tr>
<td><input type="text" name="grades[][subject]" id="grades[][subject]" value="" /></td>
<td><input type="text" name="grades[][description]" id="grades[][description]" value="" /></td>
<td><input type="text" name="grades[][grade]" id="grades[][grade]" value="" /></td>
<td><input type="text" name="grades[][remark]" id="grades[][remark]" value="" /></td>
</tr>
<tr>
<td><input type="text" name="grades[][subject]" id="grades[][subject]" value="" /></td>
<td><input type="text" name="grades[][description]" id="grades[][description]" value="" /></td>
<td><input type="text" name="grades[][grade]" id="grades[][grade]" value="" /></td>
<td><input type="text" name="grades[][remark]" id="grades[][remark]" value="" /></td>
</tr>
</table>
</form>
then this is my summary of insert.php
$course = $_POST["course"];
$semester = $_POST["semester"];
$year = $_POST["year"];
$id_no = $_POST["id_no"];
$result = $_POST["grades"];
if (count($result > 0))
{
$new = array();
foreach ($result as $key => $value)
{
$new[] = "('" . $course . "', '" . $semester . "', '" . $year . "', '" . $id_no . "', '" . $value["subject"] . "', '" . $value["description"] . "', '" . $value["grade"] . "', '" . $value["remark"] . "')";
}
if (count($new) > 0)
{
$query = mysql_query("INSERT INTO grades (course, semester, year, id_no, subject, descriptive_title, final_grades, remarks) VALUES " . implode(", ", $new)"); <----this is line 32
if ($query)
{
echo "SUCCESS";
}
else
{
echo "FAILED";
}
}
}
showing error on line 32:
Parse error: syntax error, unexpected '"' in C:\AppServ\www\sample admin\my-admin\insert_grades.php on line 32
thank you..:}hope you understand..:}
cause my codes is not working..