I am needing some guidance on how to build an array from POST Variables an then insert the data into mysql. Here is what I have
M Variable from submitted form
$parentid ="7638sds"; $child3_1_name =$_POST['chld3_1_name']; $child3_1_age =$_POST['child3_1_age']; $child3_2_name =$_POST['chld3_2_name']; $child3_2_age =$_POST['child3_2_age']; $child3_3_name =$_POST['chld3_3_name']; $child3_3_age =$_POST['child3_3_age']; $cnt="3"; $childrenContainer =" (1) Child Name : $child3_1_name -- Age: $child3_1_age \n (2) Child Name : $child3_2_name -- Age: $child3_2_age \n (3) Child Name : $child3_3_name -- Age: $child3_3_age \n ";
My mysql insert would insert each child info (consisting of name and age) and linked by the parent id
the statement is constructed as:
$insertChildCount ="INSERT childrenCount SET parentid='$parentid', childrenCtn='1', childName='$childName', childAge='$childOnly_age', childrenInfo='$childrenContainer'";
So essentially in the provided POST Variables, the sql would insert three children into the DB, all with the same parentid identifier.
Any thoughts on this is greatly appreciated!