Advertisement
Nikita051

Untitled

Nov 29th, 2022
1,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. public function checkbox($attrs = [])
  2.         {
  3.             $attrs['type'] = 'checkbox';
  4.             $attrs['value'] = 1;
  5.            
  6.             if (isset($attrs['name'])) {
  7.                 $name = $attrs['name'];
  8.                
  9.                 if (isset($_REQUEST[$name]) and $_REQUEST[$name] == 1) {
  10.                     $attrs['checked'] = true;
  11.                 }
  12.                
  13.                 $hidden = $this->hidden(['name' => $name, 'value' => '0']);
  14.             } else {
  15.                 $hidden = '';
  16.             }
  17.            
  18.             return $hidden . $this->open('input', $attrs);
  19.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement