I have a form which, upon submitting, saves the entered fields into a mysql database using php.
The problem arises when a user clicks on a text field, but doesn't enter any data (or enters data but then removes it) and then moves on to the next field. When the form is submitted it passes a blank value into the database instead of leaving it NULL. How do I tell it to find leave the in NULL "statement" if no data was really passed?
I think the solution involves a trim() and an if-else statement.
The reason why I need this is because I use a query to see which fields are still NULL. For example; show me all people with NULL in place of their email address. If that field contains a blank character it will be excluded since it is not null.
If anyone can help me out I would be much appreciative. If you need more information about my situation please feel free to ask. Thank you!