Hi all
I have 3 arrays which are built from a form of checkboxes/text fields being posted:
// this is a list of checkbox values posted
[toggleoptions] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)
// this is a list of text field values posted
[merchantid] => Array
(
[0] =>
[1] => 45637
[2] =>
[3] =>
)
// this is a list of text field values posted
[merchantpass] => Array
(
[0] =>
[1] => mypass
[2] =>
[3] =>
)
Each checkbox that is ticked I insert into a table as such:
$qry2 = "INSERT INTO tbltoggleoptionsgranted (optionid) VALUES ";
foreach ($toggleoptions as $toggleid) {
$qry2 .= "($toggleid), ";
}
Now what I need are the corresponding values from the other 2 arrays to be inserted into the same record above in the query.
So using the 2nd key/value pair of the checkbox array as an example, the above query needs to insert the $toggleid, and also the values from key[1] of the other 2 arrays being '45632' and 'mypass'.
I guess my query will ultimately be something like:
$qry2 = "INSERT INTO tbltoggleoptionsgranted (optionid, merchantid, merchantpass) VALUES ";
but how do I loop through the 2 arrays getting the values out for each KEY correctly?
Many thanks for reading and any solutions you may have!
kbc