在发送表单之前获取$ _POST数组[关闭]

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.

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

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