Just to recap that a foreach loop to access array data is..
foreach ($_POST[checkbox] as $bgvalue) {
//Do Stuff
}
Which is fine, but say you have some data from a form that has two elements of multiple data that need to be used - basically two arrays
(In my case its a lot of choices with two data elements of each choice)
I thought the form for it was...
foreach ($_POST[checkbox] as $bgvalue; $_POST[hiddenlink] as $lkvalue) {
//do stuff
}
Which it is not as you get the error..
Parse error: parse error, unexpected ;, expecting )
Anyone know the correct format for that please?
Thanks
Not sure where you got that idea from... you want nested foreach loops...
foreach ($_POST[checkbox] as $bgvalue) {
foreach ($_POST[hiddenlink] as $lkvalue) {
//do stuff
}
}
Cornet
Quote from: cornetNot sure where you got that idea from... you want nested foreach loops...
foreach ($_POST[checkbox] as $bgvalue) {
foreach ($_POST[hiddenlink] as $lkvalue) {
//do stuff
}
}
Cornet
Nope, becuase that returns 4 lots of 1 item each time when it should only be the once