Php checklist problem

Hello all, I am making a checklist for my dad. Hes a big sports cards collector and is always looking at checklists and making his own. So i figure i can make him a universal checklist, 1 with set names and card totals.

Here is my problem.

So far when I test the page it looks ok except for the drop down menu, it shows an empty space at the bottom and it is missing set0 from the array.

here is my code for your viewing pleasure =)


<html>
<head>
<title>TEST1</title>
<style>
.box{border: 1px solid #000000; padding:2px; float:left; width:50px; margin:2px;}
</style>

</head>

<body>

<?php

    $setName = array(
    
        set0, 
        
        set1, 
        
        set2, 
        
        set3, 
        
        set4, 
        
        set5, 
        
        set6
        
    );
    
    $index = 0;
?>


<select name="setName">

<?php

    foreach($setName as $value)
    
    {
    
    if ($index <= count($setName)){
    /* i tried != and i was missing 2 values for some reason*/
    $index++;
    
    }
    
    echo "<option value=\"$setName[$index]\">$setName[$index]</option>";
    
?>
<?php

    }

?>
<?php

    echo "</select>"

?>



<div style="width:700px; text-align:justify; display:block;">

<?php

    $setCount = 20;

?>

<?php
    
    for ($i = 1; $i <=$setCount; $i++){
    
    echo "<div class=\"box\">";
    
    echo "<input name=\"$i\" type=\"checkbox\" value=\"card$i\">$i";
    
    echo "</div>";
    
?>
    
<?php

    }

?>

</div>
</body>
</html>

also im not to savy on asoc arrays but is it possable to set multiple values in an array? for example

set0 = 50cards
set1 = 100cards
so on and so forth.
Also is it passable to update the amount of check boxes displayed depending on which item is chosen from the list?


<?php
$arr = array ( "set0" => "50cards" , ... );
?>

<select ...>

<?php

foreach ( $arr as $key => $value )
{
echo '<option value="' . $key . '">' . $value . '</option>';
}
?>

</select>

I have no idea what you’re trying to do, but the code I have will at least get you started and point you in the right direction. :slight_smile:

thanks for the reply kdd appreciate it a lot. Ill try a few thing out and see what comes of it and post my results.