How to read if a checkbox is checked in PHP?

后端 未结 18 957
刺人心
刺人心 2020-11-22 07:54

How to read if a checkbox is checked in PHP?

18条回答
  •  清酒与你
    2020-11-22 08:28

    Wordpress have the checked() function. Reference: https://developer.wordpress.org/reference/functions/checked/

    checked( mixed $checked, mixed $current = true, bool $echo = true )
    

    Description Compares the first two arguments and if identical marks as checked

    Parameters $checked (mixed) (Required) One of the values to compare

    $current (mixed) (Optional) (true) The other value to compare if not just true Default value: true

    $echo (bool) (Optional) Whether to echo or just return the string Default value: true

    Return #Return (string) html attribute or empty string

提交回复
热议问题