I have an HTML form that accepts a CVV number as one of the field items -
<label for="cvv">CVV</label>
<input type="text" placeholder="123" maxlength="3" id="cvv" name="cvv">
As you can see, it has a placeholder="123"
. I'm entering the CVV number into my database as part of an array -
$pay = array(
'cardno' => $cardno,
'exp' => $this->input->post('exp'),
'cvv' => $this->input->post('cvv'),
'name' => $this->input->post('name'),
'org' => $this->session->userdata['user_data']['org']
);
$this->db->insert('payment', $pay);
I'm able to enter any CVV value into the database except 123
which is the same as the placeholder value. I keep getting the following error -
Error Number: 1366
Incorrect integer value: '' for column 'cvv' at row 1
INSERT INTO `payment` (`cardno`, `exp`, `cvv`, `name`, `org`) VALUES ('6547893210258135', '04/20', '', 'Joe Bloggs', '15')
Filename: C:\xampp\htdocs\ci_redesign_newdb\system\database\DB_driver.php
Line Number: 330
When I print the $pay
array before inserting it into the database, with cvv as 123
, the CVV field is empty -
Array ( [cardno] => 6547893210258135 [exp] => 04/20 [cvv] => [name] => Joe Bloggs [org] => 15 )
However, if I change the CVV value to anything else, the CVV field gets populated -
Array ( [cardno] => 6547893210258135 [exp] => 04/20 [cvv] => 103 [name] => Joe Bloggs [org] => 15 )
And since that field gets populated, I'm able to enter it into the database without any errors. What could be the reason the form isn't accepting a value that is the same as the field's placeholder, i.e., 123
in this case?
EDIT 1
This problem seems to be present for all input fields in the form. I only noticed it for cvv
since I happened to enter 123
as a test. So, it looks like all the fields where the entered input value is the same as the placeholder value are not being input.
EDIT 2 - PROBLEM SOURCE
It looks like the problem is originating from the jQuery source file version 2.0.3. I commented out the file in my code -
<script src='<?php echo base_url(); ?>assets/js/jquery-2.0.3.min.js'></script>
and I was able to post the input values which were the same as my placeholder -
Array ( [cardno] => 1234567890123456 [exp] => mm/yy [cvv] => 123 [name] => Name [org] => 15 )
Is this something that can be solved by editing the jQuery source file? Should I be making such changes? Don't want to make changes that could cause problems elsewhere.