X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=encode.php;fp=encode.php;h=c08f8afe0e1890f668d2f18639cb9ecd00599aa0;hb=c3133300f98840b9cedd56f6269274810160d6c2;hp=6d386b36f022c83575db038a4eec9c22d6f31aab;hpb=78ac62ae5af653593aaa74237872acba31f70663;p=wfpl.git diff --git a/encode.php b/encode.php index 6d386b3..c08f8af 100644 --- a/encode.php +++ b/encode.php @@ -106,6 +106,18 @@ function enc_checked($str) { } } +# checkboxe values are stored in the db and handled in php as 0 or 1. When you +# want it displayed as "Yes" or "No" use this: +# Example: (displaying values from a form submission) Over 60?: ~over_60.yesno~ +function enc_yesno($str) { + if($str && $str !== 'No' && $str !== 'False' && $str !== 'false') { + return 'Yes'; + } else { + return 'No'; + } +} + + # add a tab at the begining of each non-empty line function enc_tab($str) { $lines = explode("\n", $str);