/ Published in: PHP
Simple simple simple function to make a checkbox for a form. Retains checked status.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // Function Get Check Box // // Make a simple checkbox for a form // // $name -> the name and id of the html checkBox // $style -> optional styling to add in to the check box // // works with _POST, if the box was checked it will remain checked on repost or reload // function getCheckBox( $name , $style = "" ) { $on = ( $_POST[$name] == "on" ) ? " checked " : ""; // this is done cause some browsers... like to use 'On' instead of 'on' { $style = "style=\"".$style."\""; } return "<input ".$style." type=\"checkbox\" id=\"".$name."\" name=\"".$name."\"".$on."/>"; } ?>
URL: http://www.itsgotto.be/cv.php