HTML Select Option Value as Null Using PHP



The short answer is no. POST/GET values are never null. The best they can be is an empty string, which can then be converted to null/'NULL' −

Example

 Live Demo

if ($_POST['value'] === '') {
   $_POST['value'] = null;
}
echo'Null assigned';

Output

This will produce the following output −

Null assigned
Updated on: 2020-04-07T13:12:47+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started