Welcome Guest, Not a member yet? Register   Sign In
Checkbox checked value with foreach 2 arrays of different size
#2

In your 3rd code-block, you have 2 foreach ... loops.
Forget the first one.
In the second one:
PHP Code:
$ck in_array($sess_temp['step4'],$lt['id']) ? 'checked' NULL
This single line of code can "calculate" the correct value for $ck. It checks if the $lt['id'] value is in the $sess_temp['step4'] array.

The step4 array is an associative array, but you don't do anything with the $key, so you don't really need that.

The rest of the code seems OK to me.
Reply


Messages In This Thread
RE: Checkbox checked value with foreach 2 arrays of different size - by Wouter60 - 03-06-2017, 11:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB