I might be missing something, but I cannot understand what is going on.
The values in $_POST
variable in my php script do not match the values which are sent in the Form data.
Here is what I am doing. I am sending two consecutive requests to the same php script. All Form Data values are the same in both requests except one field. However in php script the $_POST
variable has the same value for that field in both requests.
Here is the raw Form Data which I send in my first request to the server:
sEcho=1&iColumns=1&sColumns=&iDisplayStart=0&iDisplayLength=20&mDataProp_0=0&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&fromSid=1050&fromTable=file2.xlsx&toSid=1049&toTable=file1.xlsx&fromTransInput=columnToMatch&toTransInput=columnToMatch&action=getDistinctFromTable&pageLength=20
Here is the raw input content which I get in my php script:
sEcho=1&iColumns=1&sColumns=&iDisplayStart=0&iDisplayLength=20&mDataProp_0=0&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&fromSid=1050&fromTable=file2.xlsx&toSid=1049&toTable=file1.xlsx&fromTransInput=columnToMatch&toTransInput=columnToMatch&action=getDistinctToTable&pageLength=20"
Notice that the action value doesn't match. And the value which I have in php script is actually the action value which is sent in the second request.
Here is the second request Form Data:
sEcho=1&iColumns=1&sColumns=&iDisplayStart=0&iDisplayLength=20&mDataProp_0=0&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&fromSid=1050&fromTable=file2.xlsx&toSid=1049&toTable=file1.xlsx&fromTransInput=columnToMatch&toTransInput=columnToMatch&action=getDistinctToTable&pageLength=20
And here is the raw input content from php scrip for the second request:
sEcho=1&iColumns=1&sColumns=&iDisplayStart=0&iDisplayLength=20&mDataProp_0=0&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&fromSid=1050&fromTable=file2.xlsx&toSid=1049&toTable=file1.xlsx&fromTransInput=columnToMatch&toTransInput=columnToMatch&action=getDistinctToTable&pageLength=20
Any ideas what is going on?
Update: Here is some code:
On the client I have this:
For the first request:
$.ajax({ url: '../dataMatchChecker/getDataTables.php', data: [{"name":"sEcho","value":1},{"name":"iColumns","value":1},{"name":"sColumns","value":""},{"name":"iDisplayStart","value":0},{"name":"iDisplayLength","value":20},{"name":"mDataProp_0","value":0},{"name":"sSearch","value":""},{"name":"bRegex","value":false},{"name":"sSearch_0","value":""},{"name":"bRegex_0","value":false},{"name":"bSearchable_0","value":true},{"name":"fromSid","value":"1050"},{"name":"fromTable","value":"file2.xlsx"},{"name":"toSid","value":"1049"},{"name":"toTable","value":"file1.xlsx"},{"name":"fromTransInput","value":"columnToMatch"},{"name":"toTransInput","value":"columnToMatch"},{"name":"action","value":"getDistinctFromTable"},{"name":"pageLength","value":20}], type: 'post', dataType: 'json', success: function(json) { // do some work here } });
For the second request:
$.ajax({ url: '../dataMatchChecker/getDataTables.php', data: [{"name":"sEcho","value":1},{"name":"iColumns","value":1},{"name":"sColumns","value":""},{"name":"iDisplayStart","value":0},{"name":"iDisplayLength","value":20},{"name":"mDataProp_0","value":0},{"name":"sSearch","value":""},{"name":"bRegex","value":false},{"name":"sSearch_0","value":""},{"name":"bRegex_0","value":false},{"name":"bSearchable_0","value":true},{"name":"fromSid","value":"1050"},{"name":"fromTable","value":"file2.xlsx"},{"name":"toSid","value":"1049"},{"name":"toTable","value":"file1.xlsx"},{"name":"fromTransInput","value":"columnToMatch"},{"name":"toTransInput","value":"columnToMatch"},{"name":"action","value":"getDistinctToTable"},{"name":"pageLength","value":20}], type: 'post', dataType: 'json', success: function(json) { // do some work here } });
On my server for now I just var_dump $_POST
variable (I also var_dump raw content which I presented above):
var_dump($_POST);
$postdata = file_get_contents("php://input");
var_dump($postdata);