/ Published in: PHP
Small function so that I can quickly create Yes and No form radio tickers... 0 and 1, it stores better in the DB.
Expand |
Embed | Plain Text
// Function: getYesNo // // Easy Peasy function to make quick yes/no radio sets for forms. // // // $name -> the name of the radio group // function getYesNo( $name ) { $temp .= "<input type=\"radio\" name=\"".$name."\" value=\"1\" "; if( $_POST[$name] >= 1 ) { $temp .= "CHECKED"; } $temp .= " /> " . "yes" . "\n"; $temp .= " "; $temp .= "<input type=\"radio\" name=\"".$name."\" value=\"0\" "; { $temp .= "CHECKED"; } $temp .= " />"; $temp .= " " . "no" . "\n"; return $temp; }
You need to login to post a comment.
