This works for the text fields, but i can't get it to work for the checkboxes. Here is some of the code as an example...
form.php
Code: Select all
<input type="text" name="mobile" value="<?php echo $form->value("mobile"); ?>" />
<lable><input type="checkbox" name="optional[]" value="chk1" />Box 1</label>
<lable><input type="checkbox" name="optional[]" value="chk2" />Box 2</label>
<lable><input type="checkbox" name="optional[]" value="chk3" />Box 3</label>
process.php
Code: Select all
function value($field) {
if(array_key_exists($field, $this->values)) {
return htmlspecialchars(stripslashes($this->values[$field]));
}
else {
return "";
}
}
Code: Select all
<input type="checkbox" name="optional[]" value="chk1" <?php if($form->value("optional") !=""){ echo "checked == 'checked'"; } ?> />
I have also tried many variations of the code above with no success...can anyone please help?