-7

Situation:

<form method='post' action='troll.php'>
    <input type='text' name='trolltext'>
    <textarea name='trollarea'></textarea>
    <input type='hidden' name='trollhidden'>
    <select name='trollselect'>
        <option value='troll1'>
        ...
    </select>
    <input type='submit'>
</form>

I want to var dump the $_POST array BEFORE sending to troll.php, for example, in javascript console.log. I want to see one array, no every single variables.

user3383675
  • 1,041
  • 5
  • 12
  • 31

2 Answers2

3

Well, you can't execute PHP before executing PHP. Use your browser's debugger and some JavaScript.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
0

Loop over all inputs and store their values in an array using javascript/jQuery in the client side (NO PHP):

var inputs=[];
$("form :input").each(function(){
  var input = $(this); // This is the jquery object of the input, do what you will
 inputs.push(input.val());
});
console.log(inputs);//your array
Charaf JRA
  • 8,249
  • 1
  • 34
  • 44