title: sending array to php function
body: <p>am trying send an array to php file using $_POST ,still always getting an undefined variable
  any idea !! </p>
  
  <pre><code>var all = [];
  var textInput = $('input[type=text]');
  var checkBox = $('input[type=checkbox]');
  var radio = $('input[type=radio]');
  textInput.each(function () {
      if ($(this).val() != "") {
          name = $(this).attr('name');
          value = $(this).attr('value');
          all[name] = value;
      }
  });
  checkBox.each(function () {
      if ($(this).attr("checked")) {
          name = $(this).attr('name');
          value = $(this).attr('value');
          all[name] = value;
      }
  });
  radio.each(function () {
      if ($(this).attr("checked")) {
          name = $(this).attr('name');
          value = $(this).attr('value');
          all[name] = value;
      }
  });
  var getSelect = $('#experince');
  if (getSelect[0].selectedIndex != 0) {
      name = getSelect[0].name;
      value = getSelect[0].selectedIndex;
      all[name] = value;
  }
  $.post('test.php', all, function (data) {
      alert(data);
      $.each(data, function (key, value) {
          alert(value);
      });
  }, 'json');
  </code></pre>
  
  <p>PHP FILE </p>
  
  <pre><code>    if(!isset($_POST['workF'])){
      $_POST['workF'] ="undefine";
  }
  
  if(!isset($_POST['workP'])){
      $_POST['workP']="undefine";
  
  }
  
  if(!isset($_POST['gender'])){
      $_POST['gender']="undefine";
  }
  
  if(!isset($_POST['experince'])){
      $_POST['experince']="undefine";
  }
  
  if (!isset($_POST['jobs'])){
      $_POST['jobs']="undefine";
  }
  
  if(!isset($_POST['location'])){
      $_POST['location']="undefine";
  
  }
  
  $work_type_f = $_POST['workF'];
  $work_type_p = $_POST['workP'];
  $gender = $_POST['gender'];
  $experince = $_POST['experince'];
  $jobs = $_POST['jobs'];
  $location =$_POST['location'];
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/B8wIl.jpg" alt="enter image description here"></p>