but i am having trouble inserting the values from the form, so for each checkbox which i checked i need to record that skill and level for that instructor.
I am getting this error when i try to insert:
Notice: Undefined variable: skill_id in f:\inetpub\students\cpe3002\18955673\barry\admin\instructor\AddIns.php on line 247
Notice: Undefined index: skill_level in f:\inetpub\students\cpe3002\18955673\barry\admin\instructor\AddIns.php on line 247
insert into instructor_skill (ins_id, skill_id, skill_level) values (ins_id_seq.currval,,'')
Warning: ociexecute(): OCIStmtExecute: ORA-00936: missing expression in f:\inetpub\students\cpe3002\18955673\barry\admin\instructor\AddIns.php on line 253
Here is my code:
For the checkbox array
Code: Select all
<?
while (OCIFetchInto($stmt, $results, OCI_ASSOC))
{
$skill_id = $results["SKILL_ID"];
?>
<tr>
<td><? echo $results["SKILL_DESC"]; ?></td>
<td><input type="checkbox" name="skill" value="<? echo $results["SKILL_ID"]; ?>"></td>
<td align = "center"><input type = "radio" name = "<? echo $skill_id ?>" value = "advanced" checked /><br />Beginner</td>
<td align = "center"><input type = "radio" name = "<? echo $skill_id ?>" value = "intermediate" /><br />Intermediate</td>
<td align = "center"><input type = "radio" name = "<? echo $skill_id ?>" value = "beginner" /><br />Advanced</td>
</tr>
<?
}
?>Code: Select all
for ($counter=0; $counter<sizeof($_POST["skill"]); $counter++)
{
$query = "insert into instructor_skill (ins_id, skill_id, skill_level) values
(ins_id_seq.currval,'".CleanSQL( $_POST["skill_id"][$counter])."','".CleanSQL( $_POST["skill_level"][$counter])."')";
echo $query;
$stmt = OCIParse($conn, $query) or die ('Can not parse query');
OCIExecute($stmt);
OCIFreeStatement($stmt);
}