Skip to content

Instantly share code, notes, and snippets.

(function() {
if(navigator.appVersion.indexOf('MSIE 8') > 0) {
var _slice = Array.prototype.slice;
Array.prototype.slice = function() {
if(this instanceof Array) {
return _slice.apply(this, arguments);
} else {
var result = [];
var start = (arguments.length >= 1) ? arguments[0] : 0;
var end = (arguments.length >= 2) ? arguments[1] : this.length;
@bpmbriguy
bpmbriguy / array_to_checkboxes
Created June 21, 2013 18:40
PHP loop to generate checkboxes from array of values
<?php
foreach($services_array as $k => $v)
{
$checked = isset($_POST['lookingfor']) && in_array($v, $_POST['lookingfor']) ? 'checked="yes"' : null;
echo "<input type=\"checkbox\" name=\"lookingfor[]\" value=\"$v\" $checked /> $v<br />";
}
?>