I have a form which I am using POST to post to the HTTP headers. I am trying to print_r the variables but I am not sure how to as the variables are in arrays within an array.
print_r($_POST); gives me
Array ( [y] => Array ( [0] => 124 ) [x] => Array ( [0] => 02:23PM ) )
My code:
public function index(SS_HTTPRequest $request) {
if($request->postVars(y)) {
print_r ($request);
}
}
I know I am missing something but not sure what it is.
You are using postVars
, which gives you all the post variables. What you want, to get a single postVar, is something like this: $request = $this->getRequest(); Debug::dump($request->postVar('x'));