how to split the data from $_POST var_dump in php -
hi guy's first time using var_dump
in php function. don't know how split data var_dump
maybe can me give example split data. hope method simple can understand. have try search in forum , can understand it.
please give me simple example that. please explain me. use code data. because 1st time.
<?php include('../../connections/koneksi.php'); $tabledata = var_dump($_post); echo $array; ?>
this actual data http://jsfiddle.net/minervaz/us4a9gkl/
- you can't use
echo
display object or array.so usevar_dump()
orprint_r()
javascript code :
<script type="text/javascript"> $(document).on('click','#display_data',function(e){ var converttabletojson = function() { var rows = []; $('.table-bordered tr:has(td)').each(function(i, n){ var $row = $(n); rows.push([ $row.find('td:eq(0)').text(), $row.find('td:eq(1)').text(), $row.find('td:eq(2)').text(), $row.find('td:eq(3)').text(), $row.find('td:eq(4)').text(), $row.find('td:eq(5)').text(), $row.find('td:eq(6)').text(), $row.find('td:eq(7)').text(), ]); }); return json.stringify(rows); }; var data = converttabletojson(); $.ajax({ data: { 'table-bordered': data }, type:"post", url:"../php/tagihan/save_data.php", success: function(data){ //alert(json.stringify(data)); console.log(data); } }); }); </script>
php code:
if(isset($_post['table-bordered'])){ $array=json_decode($_post['table-bordered'],true); print_r($array); }
output
array ( [0] => array ( [0] => 101200 [1] => wcb [2] => 101 [3] => 5006540050 [4] => 1 [5] => 10.08.2017 [6] => 23.970 [7] => kg ) [1] => array ( [0] => 101200 [1] => wcb [2] => 101 [3] => 5006539985 [4] => 1 [5] => 10.08.2017 [6] => 42.970 [7] => kg ) )
Comments
Post a Comment