Hi guys, I am creating dozens of rows in a form from a database. Each row has about 10 fields. I need to be able to update all or some of the rows then INSERT them back into the database with one submit button.
I've done some research and it looks like I need to use the FOREACH loop, but I can't seem to get my head around how to write the code for inserting 10 or so fields and 30 or so rows.
Do I need to create a FOREACH for every field:
$arrOid = $_POST['oid']; foreach($arrOid as $key=>$value)
$arrPid = $_POST['pid']; foreach($arrPid as $key=>$value)
$arrCase = $_POST['case_no']; foreach($arrCase as $key=>$value)
and so on...
My fields are as follows:
$oid = $_POST['oid'];
$pid = $_POST['pid'];
$poid = $_POST['poid'];
$cid = $_POST['cid'];
$county_id = $_POST['county_id'];
$day = $_POST['day'];
$time = $_POST['time'];
$case_no = $_POST['case_no'];
$ssn = $_POST['ssn'];
Can someone please create an example for me, I would be much appreciative.
I've done some research and it looks like I need to use the FOREACH loop, but I can't seem to get my head around how to write the code for inserting 10 or so fields and 30 or so rows.
Do I need to create a FOREACH for every field:
$arrOid = $_POST['oid']; foreach($arrOid as $key=>$value)
$arrPid = $_POST['pid']; foreach($arrPid as $key=>$value)
$arrCase = $_POST['case_no']; foreach($arrCase as $key=>$value)
and so on...
My fields are as follows:
$oid = $_POST['oid'];
$pid = $_POST['pid'];
$poid = $_POST['poid'];
$cid = $_POST['cid'];
$county_id = $_POST['county_id'];
$day = $_POST['day'];
$time = $_POST['time'];
$case_no = $_POST['case_no'];
$ssn = $_POST['ssn'];
Can someone please create an example for me, I would be much appreciative.