multiple posts in one $this->request->post['name']

phillystyle123 used Ask the Experts™
I'd like to be able to use another post in my $this->request statement

turn this


into this

$this->request->post['name'] post['lastname']

getting an error with everything i try -any ideas?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

$this->request->post['name'] post['lastname'] is not a valid php syntax.

Don't know what kind of framework you're using, but I guess $this->request->post is an array that contains all your POST values.

If lastname is a field in the POST form, then you can retrieve it by calling


If this doesn't work, then you need to provide more specific info like which framework you're using, what exactly do you need, and what error you're getting.

By the way, since you can call $this->request->post['name'], try print_r($this->request->post) to see how many POST values you can get from there.
Most Valuable Expert 2018
Distinguished Expert 2018
I'm with dsmile on this one. It looks like a framework specific class for handling for data. If you're trying to get a string based on the name and lastname fields from a form, then something like this might be what you're after.

$fullName = $this->request->post['name'] . " " . $this->request->post['lastname'];

If not, then please be more specific with the details of your setup.


pefecto -thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial