- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Is it possible to have a 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
if ($_POST['value'] === '') { $_POST['value'] = null; } echo'Null assigned';
Output
This will produce the following output −
Null assigned
- Related Articles
- Is it possible to use MongoDB field value as a pattern in $regex?
- HTML option value Attribute
- Is it possible to use MongoDB field value as pattern in $regex?
- HTML DOM Option value Property
- Is it possible to select text boxes with JavaScript?
- Is it possible to have an HTML canvas element in the background of my page?
- Is it possible to have a function-based index in MySQL?
- How it is possible to insert a zero or an empty string into a MySQL column which is defined as NOT NULL?
- Insert the results of a MySQL select? Is it possible?
- How to select a drop-down menu option value with Selenium (Python)?
- Is it possible to manually set the attribute value of a Web Element using Selenium?
- How to select ID column as null in MySQL?
- MySQL select query to fetch data with null value?
- Select a field and if it's null, select another with MySQL?
- Is it possible to have JavaScript split() start at index 1?

Advertisements