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 PostWow, can you please give us more explanation on what you are trying to achieved here.
I thought when you do this;
INSERT INTO `YourTable`(`col-1`, `col-2`, `col-3`) VALUES ("",[value-2],[value-3])
That should give you an empty value for the col-1.. or you can set the table null …
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;
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.