Jodarecode
03-12-2009, 06:39 PM
The code below saves top portion of the order form. What I need is to save 240 other fields, they are named and shown as:
each row is textbox_r1_c1, textbox_r1_c2, textbox_r1_c3, textbox_r1_c4, textbox_r1_c5, textbox_r1_c6, textbox_r1_c7, textbox_r1_c8, textbox_r1_c9
next row is textbox_r2_c1 thru textbox_r2_c9
3rd row is textbox_r3_c1 thru textbox_r3_c9
4th row is textbox_r4_c1 thru textbox_r4_c9
5th...
6th...
and so on to a total of 240 fields....
How would I go about saving those specific fields into the database as well as the fields noted below? Or maybe I can save all fields and not the hidden ones or the ones I dont want saved?
$fieldstoinsert=array('purchaser', 'orderno', 'contact', 'shipto', 'street', 'city', 'state', 'zip', 'orderdate', 'reqshipdate', 'shipviaUPS', 'shipviaTC', 'shiptotel', 'dealertel', 'mobiletel', 'specinstr', 'blumotion', 'casetape', 'caseconst', 'drwbox', 'state', 'RosBox', 't2', 't3', 't4', 't5', 't6', 't7', 't8');
$query = "INSERT INTO formdata (userid, fieldid, value, saveas) VALUES";
foreach($_POST as $fieldid => $value){
if(in_array($fieldid,$fieldstoinsert)){
if(trim($value)!=""){
$query.= "('$userid', '$fieldid', '$value', '$saveas'),";
}
}
}
$query=substr($query,0,-1);
each row is textbox_r1_c1, textbox_r1_c2, textbox_r1_c3, textbox_r1_c4, textbox_r1_c5, textbox_r1_c6, textbox_r1_c7, textbox_r1_c8, textbox_r1_c9
next row is textbox_r2_c1 thru textbox_r2_c9
3rd row is textbox_r3_c1 thru textbox_r3_c9
4th row is textbox_r4_c1 thru textbox_r4_c9
5th...
6th...
and so on to a total of 240 fields....
How would I go about saving those specific fields into the database as well as the fields noted below? Or maybe I can save all fields and not the hidden ones or the ones I dont want saved?
$fieldstoinsert=array('purchaser', 'orderno', 'contact', 'shipto', 'street', 'city', 'state', 'zip', 'orderdate', 'reqshipdate', 'shipviaUPS', 'shipviaTC', 'shiptotel', 'dealertel', 'mobiletel', 'specinstr', 'blumotion', 'casetape', 'caseconst', 'drwbox', 'state', 'RosBox', 't2', 't3', 't4', 't5', 't6', 't7', 't8');
$query = "INSERT INTO formdata (userid, fieldid, value, saveas) VALUES";
foreach($_POST as $fieldid => $value){
if(in_array($fieldid,$fieldstoinsert)){
if(trim($value)!=""){
$query.= "('$userid', '$fieldid', '$value', '$saveas'),";
}
}
}
$query=substr($query,0,-1);