Hi,
I want blank textbox value to be inserted into the database.
For that I kept those fields 'default NULL' in mysql. Still doesn't take empty textboxes to be saved blank. What should I do? where am I wrong?
h2so4_2003 0 Newbie Poster
Recommended Answers
Jump to PostWhat type is the field in your database?
Jump to PostDecimal fields won't like empty values being passed even if they are set to NULL so you will need to run some checks and apply a value if the posted data is empty, for example
$this->_amount = !empty($_POST["txtamount"]) ? $_POST["txtamount"] : NULL;
Jump to PostFor a start, this is wrong values'.'(
I don't know what you are trying to do their but it will break your script. You are also mixing styles of quote marks in your value parenthesis so change them all to be the same.Try this:
"INSERT …
All 11 Replies
simplypixie 123 Posting Pro in Training
veedeoo 474 Junior Poster Featured Poster
h2so4_2003 0 Newbie Poster
simplypixie 123 Posting Pro in Training
h2so4_2003 0 Newbie Poster
simplypixie 123 Posting Pro in Training
h2so4_2003 0 Newbie Poster
simplypixie 123 Posting Pro in Training
h2so4_2003 0 Newbie Poster
h2so4_2003 0 Newbie Poster
h2so4_2003 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.