I'm adding a new record in my MySql DB with javascript and I have to elaborate this function in PHP.
$(document).on('submit', '#product_form', function(event){    
event.preventDefault();
  //btn_action="add_pricelvl"; //Set variable to call the add new item 
  var valdata = $(this).serialize(); //Array with field value 
  var tax = $('#item_tax').val(); //checkbox tax 
  var taxvalue = $('#item_taxvalue').val(); //inputbox tax
  var tabledets = it_det //Read the detail table
   .rows()
   .data();
  var arr1=[];//Declare the array 
  var i=0;
  //Put the datatable(item_details) rows in the array
  for (i=0; i<tabledets.length; i++){
   arr1[i]=tabledets.rows(i).data(); 
  }
  //call ajax function and send variable to php file.
  $.ajax({
   processData: false,
   url:'item_action.php',
            method:"POST",
            data:{
    //btn_action:btn_action, 
    valdata:valdata,
    tax:tax,
    taxvalue:taxvalue,
    arr1:arr1
    },   
            success : function(data)
            {
            ....
            }
            error : function () {
        ....
        }
      })
    });<?php
if ($_POST['btn_action']=='add_pricelvl'){
  $query="....."
  //Getting variables by JavaScript
}
?>I can't get any variable in my PHP file... how is that possible?
Trying to check any $_POST[variable] in the PHP File they are NULL... why?
 
     
     
    