Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I see which checkbox is checked?

How do I check in PHP whether a checkbox is checked or not?

like image 383
Karem Avatar asked Feb 15 '10 21:02

Karem


People also ask

How do you check if a checkbox is checked or not in react?

Use the target. checked property on the event object to check if a checkbox is checked in React, e.g. if (event. target. checked) {} .

What is checked in checkbox?

The checked attribute is a boolean attribute. When present, it specifies that an <input> element should be pre-selected (checked) when the page loads. The checked attribute can be used with <input type="checkbox"> and <input type="radio"> . The checked attribute can also be set after the page load, with a JavaScript.


1 Answers

If the checkbox is checked, then the checkbox's value will be passed. Otherwise, the field is not passed in the HTTP post.

if (isset($_POST['mycheckbox'])) {     echo "checked!"; } 
like image 173
Tomas Markauskas Avatar answered Sep 30 '22 21:09

Tomas Markauskas