Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP : How to get all variable name in php post method

Tags:

php

I would like to get and display all variable names which are posted by method="post" in a form. I am not aware of variables which passed from post method in HTML. Is there any method to list the all variables posted by post method ?.. Thanks in advance.

example: http://www.dhamu.in/oncreate2.php?workload=10&request_type=project&name=web%20design&description=we%20have%20done%20it&budget=1&bidperiod=11&project_guidelines=checked&job_113=1&xxxx=10 Here i do no the variable name "xxxx"

like image 556
Lotuspandiyan Avatar asked Mar 19 '12 13:03

Lotuspandiyan


1 Answers

foreach ($_POST as $key => $value){
  echo "{$key} = {$value}\r\n";
}

And BTW, those are $_GET variables (so adjust the above to use foreach ($_GET as $key => $value){.) You can also use $_REQUEST to cover both.

like image 78
Brad Christie Avatar answered Nov 09 '22 12:11

Brad Christie