I'm trying to insert as many as records as possible but less than 100 into a table.
First, i get the count inorder how many to add and then depending on the count, i get so many blank form fields to enter.
Now, I noticed something really strange.
1.Only the last entered record is inserted into the table.
2.For example, when I type a name, Let us assume "WORLD", only w is inserted into the table and the rest is not.It is the same with all the form fields.whether, i'm trying to enter text or a number,only the first character is inserted.This sounds weird.
Could somebody pls tell me why is this peculiar behaviour
Here is the code:
<?
Database connection
if ($frm_save == 1){
if ($enrolment==NULL) $enrolment=0;
if ($ciphering=="") $ciphering=0;
$sql = "Insert into TBL_RBS(RBS_TFTPFILENAME, RBS_TFTPSERVERIPADDRESS, RBS_RFPI, RBS_IPADDRESS, RBS_ENROLMENT, RBS_CIPHERING, RBS_MACADDRESS, RBS_SUBNETMASK, RBS_ROUTERIP) values ('$tftp_file[$i]','$tftp_server[$i]','$rfpi[$i]','$ip_address[$i]','$enrolment[$i]','$ciphering[$i]','$mac_address[$i]','$subnet_mask[$i]','$router_ip[$i]')";
//echo "$sql";
$result = ibase_query($connection, $sql);
ibase_commit();
}
?>
<?
//Get the number to add:
This code works fine!!!
else
{
?>
<?
//checks for array length
for ($i = 0; $i < $rbscount; $i ++)
{
$num = $i;
if (strlen($num) == "1") $num = "0" . $num;
?>
<INPUT type="text" size="10" name="rfpi" value="<? echo $rfpi; ?>"style="padding:0;">
<INPUT type=checkbox name="enrolment" value="1"<? if ($enrolment==1)echo "checked";?>>
<INPUT type=checkbox name="ciphering" value="1" <? if ($ciphering==1)echo "checked";?>>
and rest of the fields over here..........
<?
}
?>
</table>
<Input type="image" src="../images/sign_save.gif" name="save_button" value="Save"></br>
<input type="hidden" name="frm_save" value="1">
<?
}
?>
</body>
</html>