TAGS :Viewed: 3 - Published at: a few seconds ago

[ jQuery serializeArray doesn't work in server side ]

I have a forms with about 40 fields in my page, so I decided to use jQuery serializeArray() method to retrieve this values.
So, I wrote this lines in my **jQuery** code:

            $(document).on('click', '#send_bosch_package_detail', function() {
                var data = $('#frmbosch').serializeArray() ; 
                    data: data,
                    success: function(result) {

and in my PHP code:
I'm using PDO for DataBase stuff and this lines are part of my PHP page

$exe = $prepare->execute( array( 
) );

Would you tell me which part of my Code is wrong??
When I try var_dump($_POST) in my PHP code, every thing is OK, but when I try to write the values to my DB, I see undefined index in $_POST error for all of mu fields!!!!
error<code>enter code here</code>
Either when I dump the $exe with var_dump, the program tell me $_POST is empty... enter image description here

Thanks in advance

Answer 1

As much as I know, there is not something wrong in your code's logic,
I can't leave comment for you because of my reputation.
But, as an experience, when you use some of characters like -, /, . or etc in your DB field name, you have to separate the field names by ' or ( ` ).
for example:

'INSERT INTO yourDB( `field1`, `field2`, `field3`, ... )'


"INSERT INTO yourDB ( 'field1', 'field2', 'field3', ... )"

I think the problem should be in your PHP code