I want to loop through an array of names within my form and check the a property, is_verified for a given ID.
form:
<div class="input">
<?php echo form_dropdown(
"is_email_verified[{$email->id}]", [
0 => 'no',
1 => 'yes'
], $email->is_verified, 'id="is_'. $email->id . '_verified"'
); ?>
</div>
print_r($this->input->post()) gives:
"Array (
...
[is_email_verified] => Array(
[123] => 1
)
Let's say there are more than one e-mails, and I'm looping through these e-mails, checking if the id's (in this case, 123) is_verified bool is set to 0 or 1.
I tried this but it doesn't work:
foreach ($member->emails as $email) {
if ($this->input->post("is_email_verified[$email->id]") == '1') {
How can I loop through the form values and check against that specific ID in the array?