I am trying to achieve this <fieldset class="tercero" style="" > <legend>Services</legend> <ol> <li> <input type="checkbox" name="example" value="delivery" style=" * position:relative; left:-16px; text-indent:inherit; positio\n:inherit; lef\t:13px; text-ali\gn:inherit;" /><span class="colo23">Delivery</span><br /> <input type="checkbox" name="example" value="eat-in" /><span class="checkboxes23">Eat-in</span><br /> <input type="checkbox" name="example" value="wifi" /><span class="checkboxes23">Wi-Fi</span><br /> <input type="checkbox" name="example" value="buffet" /><span class="checkboxes23">Buffet</span><br /> <input type="checkbox" name="example" value="tv" /><span class="checkboxes23">Tv</span><br /> <input type="checkbox" name="example" value="parking" /><span class="checkboxes23">Parking</span><br /> <input type="checkbox" name="example" value="catering" /><span class="checkboxes23">Catering</span><br /> <input type="checkbox" name="example" value="take-out" /><span class="checkboxes23">Take Out</span><br/> </li></ol> </fieldset> Code (markup): foreach loop the input and span tags instead of repeat the <li> input and span tags Like. <fieldset class="tercero" style="" > <legend>Services</legend> <ol> <li class="restaurants-offerings-4"> <input type="checkbox" name="frmSearch[offerings][]" value="4" id="restaurants-offerings-4"> <span for="restaurants-offerings-4" class="checkboxes23">Buffet</span> </li><li class="restaurants-offerings-7"> <input type="checkbox" name="frmSearch[offerings][]" value="7" id="restaurants-offerings-7"> <span for="restaurants-offerings-7" class="checkboxes23">Catering</span> </li><li class="restaurants-offerings-1"> <input type="checkbox" name="frmSearch[offerings][]" value="1" id="restaurants-offerings-1"> <span for="restaurants-offerings-1" class="checkboxes23">Delivery</span> </li><li class="restaurants-offerings-2"> <input type="checkbox" name="frmSearch[offerings][]" value="2" id="restaurants-offerings-2"> <span for="restaurants-offerings-2" class="checkboxes23">Eat-in</span> </li><li class="restaurants-offerings-6"> <input type="checkbox" name="frmSearch[offerings][]" value="6" id="restaurants-offerings-6"> <span for="restaurants-offerings-6" class="checkboxes23">Parking</span> </li><li class="restaurants-offerings-5"> <input type="checkbox" name="frmSearch[offerings][]" value="5" id="restaurants-offerings-5"> <span for="restaurants-offerings-5" class="checkboxes23">TV</span> </li><li class="restaurants-offerings-8"> <input type="checkbox" name="frmSearch[offerings][]" value="8" id="restaurants-offerings-8"> <span for="restaurants-offerings-8" class="checkboxes23">Takeout</span> </li><li class="restaurants-offerings-3"> <input type="checkbox" name="frmSearch[offerings][]" value="3" id="restaurants-offerings-3"> <span for="restaurants-offerings-3" class="checkboxes23">Wi-Fi</span> </li> </ol></fieldset> Code (markup): What is producing to repeat the li tags is the following script, I just want the input and span tags to repeat not the li The script goes as follow <?php <fieldset class="tercero" style="" > <legend>Services</legend> <ol> <?php foreach($arrRestaurantsOfferings as $arrRestaurantsOffering) { printf( '<li class="restaurants-offerings-%u"> <input type="checkbox" name="frmSearch[offerings][]" value="%u" id="restaurants-offerings-%u"%s> <span for="restaurants-offerings-%u" class="checkboxes23">%s</span> </li>' ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['restaurant_offerings_id'] ,in_array($arrRestaurantsOffering['restaurant_offerings_id'],$arrOfferings)?' checked="checked"':'' ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['name'] ); } ?> <?php } ?></ol></fieldset> ?> PHP: The problem lays down here <?php '<li class="restaurants-offerings-%u"> <input type="checkbox" name="frmSearch[offerings][]" value="%u" id="restaurants-offerings-%u"%s> <span for="restaurants-offerings-%u" class="checkboxes23">%s</span> </li>' ?> PHP: I have changed to this <ol><li> <?php foreach($arrRestaurantsOfferings as $arrRestaurantsOffering) { printf( ' <input type="checkbox" name="frmSearch[offerings][]" value="%u" id="restaurants-offerings-%u"%s> <span for="restaurants-offerings-%u" class="checkboxes23">%s</span> ' ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['restaurant_offerings_id'] ,in_array($arrRestaurantsOffering['restaurant_offerings_id'],$arrOfferings)?' checked="checked"':'' ,$arrRestaurantsOffering['restaurant_offerings_id'] ,$arrRestaurantsOffering['name'] ); } ?> <?php } ?></li></ol> PHP: In other words I have taken the <li> tags out of the loop but then "%u" which is the code that prints the name of the offering and pass in <li> tags and pass a value to the input id="restaurants-offerings-%u"> won't work, It won't pass and it will only display the id field of the food_offering table next to the checkboxes which is the type of the input. How can I get the string " %u" or the name of the offering to pass to the id of the input tags without having to put the li inside the loop and only leave the input and span tags inside the loop? By the way the food_offering table has two field one is an integer called "restaurant_offerings_id" and it's represented as "%u" in the script above inside the foreach loop and the other is an string called "name" is represented as %s found inside the foreach loop as well.