How to send a field of form Null into database? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to send a field of form Null into database?

I have created a form and gave it input type text,radio,checkbox,email. How to make any of these value Null.??so that if user submit the form without inserting anything in one field ,it will show null in database .the language I m using is php.

10th Nov 2022, 2:03 AM
parajal12
parajal12 - avatar
1 Answer
+ 3
Google search with keywords "php insert null into database" First hit: https://stackoverflow.com/questions/4620391/mysql-and-php-insert-null-rather-than-empty-string Solution (before you compose your SQL query): $x = !empty($x) ? $x : NULL;
10th Nov 2022, 5:45 AM
Tibor Santa
Tibor Santa - avatar