Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SChaput

macrumors regular
Original poster
Jul 2, 2008
153
0
United States
How embarrassing. A simple change of "selected" to "checked" fixed the issue.
------

I'm trying to utilize php explode and IF/OR statements in my current code but having some issues.

In the beginning of the code i explode a string into an array. Then use the following code to try and auto select a checkbox.
Code:
<?
 if(($standards[0] == "1") || ($standards[1] ==  "1") || ($standards[2] ==  "1") || ($standards[3]==  "1") || ($standards[4]==  "1")){?>
  Standard 1: <input type="checkbox" name="standard_1" selected />
         <? }else{ ?>
         Standard 1: <input type="checkbox" name="standard_1" /> <? } ?>

The code trys to find if any of the values in the array standards, is 1. If it is, then it SHOULD check a checkbox. However, the checkbox remains unchecked, even if I output echo standards[0] and see that it = 1.

Any thoughts? Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.