$sanitizer->checkbox() method

Sanitize checkbox value

Available since version 3.0.128.

Usage

// basic usage
$int = $sanitizer->checkbox($value);

// usage with all arguments
$int = $sanitizer->checkbox($value, $yes = true, $no = false);

Arguments

NameType(s)Description
valueint, bool, string, mixed, null

Value to check

yes (optional)int, bool, string, mixed, null

Value to return if checked (default=true)

no (optional)int, bool, string, mixed, null

Value to return if not checked (default=false)

Return value

int bool string mixed null

Return value, based on $checked or $unchecked argument

See Also


$sanitizer methods and properties

API reference based on ProcessWire core version 3.0.168

Twitter updates

  • There’s a new modules directory on the ProcessWire site now up and running. In this post we’ll cover a few details about what’s changed and what’s new—More
    20 November 2020
  • ProcessWire 3.0.168 core updates — More
    26 October 2020
  • This week a 2nd new module for processing Stripe payments has been added to FormBuilder. Unlike our other Stripe Inputfield, this new one supports 3D Secure (SCA) payments. We’ll take a closer look at it in this post, plus a live demo— More
    16 October 2020

Latest news

  • ProcessWire Weekly #341
    In the 341st issue of ProcessWire Weekly we're going to check out the latest processwire.com blog post, introduce upcoming commercial module called NiftyPasswordsPlus, and check out a brand new site of the week. Read on!
    Weekly.pw / 21 November 2020
  • New ProcessWire modules directory
    There’s a new modules directory on the ProcessWire site now up and running. In this post we’ll cover a few details about what’s changed and what’s new.
    Blog / 20 November 2020
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani