Welcome Guest, Not a member yet? Register   Sign In
Check if exist in array (all in foreach)
#1

Hi!
I have little problem.
I need to check every row in another array, and if exist - do something.

This is my code:
PHP Code:
<?php $Sekcje explode','$Detail->SectionsPrefered ); ?>
                        <?php foreach ($SectionsList as $SectionOption): ?>
                                <div class="checkbox">
                                    <?php if ( in_array$SectionOption->Title $Sekcje ) ): ?>
                                        *
                                    <?php endif ?>
                                    <label>
                                        <input type="checkbox" value="<?php echo $SectionOption->Title?>">
                                        <?php echo $SectionOption->Title?>
                                    </label>
                                </div>
                        <?php endforeach ?>

It's display only one '*', but must display for 3 rows (Section1, Section2, Section3)

This is the array $Sekcje:
PHP Code:
array(3) { 
       [
0]=> string(8"Section1" 
       
[1]=> string(9" Section2" 
       
[2]=> string(9" Section3" 


Where is the problem?
Reply


Messages In This Thread
Check if exist in array (all in foreach) - by vertisan - 12-11-2015, 09:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB