First of all, your insert is not in a loop, so it is only making one insert.
None of your names are array names either. You can give the
names in your form square brackets, and I believe PHP will index
them for you. (i.e. s_name[])
There are a couple things I don't understand, but they are
periphial and we'll stick to the basics if possible. I don't even
understand my own code after staring at it for long enough.
Here is the example, but with a couple disclaimers.
I do not use the array type of passing form values, but I think it
works this way. I am not sure if you need to add the indices into
the names or not, and don't have the energy to look it up right
now. If all the inserts end up with the same name, add $stdcount
inside the square brackets.
Also, foreach might be a better way to loop through these, but I
don't have the energy to look it up and this way will work. I am
also not sure the best way to deal with multiple variables in a
foreach, maybe somebody can drop a comment regarding that.
I have never used ibase, either, it should be ok but you I don't
know if there are any peculiarities about the connection you need
to import into the loop. There is a possibility it might choke on the
SQL though. If it does, put all the sql in one line or concatinate it.
I would have, but I didn't think about it until right after I hit the Submit button. Oops, there it goes...
EDIT: (Ok, I think I came back and concatinated the sql statement)
EDIT AGAIN: You might also want to think about putting the commit
inside of an if condition based on what $insert_results returns, or
even move it outside the loop into an error routine to collect and
save the values in case of failure. I dunno...
SO prepare for the worst and hope for the best:
1)
Add sqare brackets to your INPUT names on the FORM
"s_name[]" "s_dept[]" "s_dob[]"
Add a hidden input in your FORM
<input type='hidden' name='stdcount' value='<?php echo $stdcount ?>'>
2)Put your SQL INSERT inside of a loop, and use array values
for ($i=0;$i<$stdcount;$i++){
$insert_sql = "Insert into TBL_STUDENTS ".
" (STD_NAME, STD_DEPT, STD_DOB) ".
" values ".
" ('$s_name[$i]','$s_dept[$i]','$s_dob[$i]')";
$insert_results = ibase_query($connection, $insert_sql);
ibase_commit();
}