Sol let's suppose that we send a post query to a PHP file,
this query where we have ...&title=title
where title is for example title=$(#title).val(); (assuming we're including Jquery)
in PHP we have $title=$_POST['title'];
Let's suppose then that title is null , will PHP consider null as string ? or something empty ?
From the PHP Manual:
The special NULL value represents a variable with no value. NULL is the only possible value of type NULL.
A variable is considered to be NULL if:
NULL."NULL" is not the same as NULL.
var_dump("null" == NULL);
Outputs:
bool(false)
The title gets converted to a string before sending it to the server.
Converting the JS value null to a string results in a string "null". Therefore, PHP will only interpret the variable as a string.
However, I doubt that you will receive a null value from an empty input box. You will get an empty string instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With