Standard form posting with jQuery to php does not get all index values? -
i'm trying submit form php somehow not data passed php?
jquery initialized post this:
var fieldsdata = $('form').serialize() $.post( "index.php", fieldsdata, function(data){ console.log( data ); });
.. fieldsdata variable try send server (i test in console)
[ { "name": "form_key", "value": "feyzybqefjjtkzai" }, { "name": "shipment_item_3", "value": "" }, { "name": "shipment[items][3]_1", "value": "21" }, { "name": "shipment[items][3]_2", "value": "22" }, { "name": "shipment[items][3]_3", "value": "31" }, { "name": "shipment[items][3]_4", "value": "42" }, { "name": "warehouse-shipment[items][3]_1", "value": "1" }, { "name": "warehouse-shipment[items][3]_2", "value": "1" }, { "name": "warehouse-shipment[items][3]_3", "value": "1" }, { "name": "warehouse-shipment[items][3]_4", "value": "1" }, { "name": "lotnumber-shipment[items][3][1]_1", "value": "4" }, { "name": "lotnumber-shipment[items][3][1]_2", "value": "5" }, { "name": "lotnumber-shipment[items][3][1]_3", "value": "5" }, { "name": "lotnumber-shipment[items][3][1]_4", "value": "6" }, { "name": "shipment_item_4", "value": "" }, { "name": "shipment[items][4]_1", "value": "7" }, { "name": "warehouse-shipment[items][4]_1", "value": "1" }, { "name": "lotnumber-shipment[items][4][1]_1", "value": "7" }, { "name": "shipment[comment_text]", "value": "" } ]
when execute call i'm monitoring network tab in inspector , can confirm form data send server correct:
and have 1 line of code inside index.php file,, debug info:
var_dump($_post);die('e');
and get:
/var/www/html/inventory174/index.php:27: array (size=6) 'form_key' => string 'feyzybqefjjtkzai' (length=16) 'shipment_item_3' => string '' (length=0) 'shipment' => array (size=2) 'items' => array (size=2) 3 => string '42' (length=2) 4 => string '7' (length=1) 'comment_text' => string '' (length=0) 'warehouse-shipment' => array (size=1) 'items' => array (size=2) 3 => string '1' (length=1) 4 => string '1' (length=1) 'lotnumber-shipment' => array (size=1) 'items' => array (size=2) 3 => array (size=1) ... 4 => array (size=1) ... 'shipment_item_4' => string '' (length=0) e
i see example variable shipment[items][3]_x
not pass keys two.. guess i'm facing somekind of variable name convention limit don's know what,, if can take fresh on data alot!
also have tested form valid, this: $('edit_form').checkvalidity() , true
back.. guess that's ok
update1: add form markup -> https://jsfiddle.net/zfn98tha/1/ update2: output $_request -> https://jsfiddle.net/zfn98tha/2/
because posting data php need format form field names valid array structure. rename shipment[items][3]_x
shipment[items][3][x]
, should indexes.
Comments
Post a Comment