How to access aoData from php document
How to access aoData from php document
rjbelandres
Posts: 6Questions: 0Answers: 0
Hi, I would like to know if there is a way I can access or get the value defined from aoData.push({ "name": "varName", "value":"varName_Value" })
from a sAjaxSource eg: myphpfile.php.
Thanks in advance and more power!!!
from a sAjaxSource eg: myphpfile.php.
Thanks in advance and more power!!!
This discussion has been closed.
Replies
parameters sent through a POST request will be placed in a PHP array named $_POST.
recent versions of PHP merge the $_GET and $_POST arrays into one array named $_REQUEST, so this is a good array to use if you mix GET and POST querystring params, or if you are not sure which is being used, or if you debug using one but in production you switch to the other.
here's some sample code to get your "varName" from above
[code]// using $_GET
$varName = ""; // you usually want to declare and define a default value for this variable
if (isset($_GET["varName"])) $varName = $_GET["varName"]; // $varName now equals "varName_Value"
// using $_POST or $_REQUEST is the same, syntactically
$varName = "";
if (isset($_REQUEST["varName"])) $varName = $_REQUEST["varName"]; // $varName now equals "varName_Value"
[/code]
------------------------------------
[here's a more succinct version doing the same thing but using the ternary operator "? :"
$varName = isset($_REQUEST["varName"]) ? $_REQUEST["varName"] : "";
]