# How to get variables from $request

**URL:** <https://discourse.slimframework.com/t/how-to-get-variables-from-request/1052>\
**Category:** Questions\
**Created:** [January 5, 2017, 5:47pm UTC](https://discourse.slimframework.com/t/how-to-get-variables-from-request/1052 "2017-01-05T17:47:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keust](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@Keust](https://discourse.slimframework.com/u/Keust)\
**Post date:** [January 5, 2017, 5:47pm UTC](https://discourse.slimframework.com/t/how-to-get-variables-from-request/1052/1 "2017-01-05T17:47:32Z")

</div>

Hi guys,

At the moment I am still fresh with PHP, OOP and learning everyday.

I can’t wrap my head around this issue (can’t seem to make it work). I am trying to validate to input fields with the Respect\Validation package and Slim3.

The documentation ([https://github.com/Respect/Validation/blob/master/docs/KeyValue.md](https://github.com/Respect/Validation/blob/master/docs/KeyValue.md)) says the following:

- keyValue(string $comparedKey, string $ruleName, string $baseKey)  
Performs validation of $comparedKey using the rule named on $ruleName with $baseKey as base.

- v::keyValue(‘password\_confirmation’, ‘equals’, ‘password’)-\>validate($\_POST);  
The above code will result on true if $\_POST[‘password\_confirmation’] is equals to $\_POST[‘password’], it’s the same of:

This is my code:  
‘password’ =\> v::noWhitespace()-\>notEmpty(),  
‘confirm\_password’ =\> v::keyValue(‘password’, ‘equals’, ‘confirm\_password’)-\>validate($request-\>getParam(‘password’)),

This is the error: ‘Call to a member function setName() on boolean’

If i try:  
‘confirm\_password’ =\> v::keyValue(‘password’, ‘equals’, ‘confirm\_password’),

This is the error: Key {{ keyname }} must be present.  
This question is also asked (but not ansewred on Stackoverflow: [http://stackoverflow.com/questions/41250041/respect-validation-keyvalue-doesnt-work-properly-with-slim3](http://stackoverflow.com/questions/41250041/respect-validation-keyvalue-doesnt-work-properly-with-slim3))

Also tried: ‘confirm\_password’ =\> v::equals(‘confirm\_password’)-\>validate(‘password’),  
Error: Call to a member function setName() on boolean

How do I implement the params? What do i miss (don’t see) here?

Thanks!
