Welcome Guest, Not a member yet? Register   Sign In
Looping over $this->request
#1

(This post was last modified: 05-12-2020, 05:49 AM by stlake2011.)

Good Morning everyone,

Quick question. Is it possible to loop over  $request object?

example:
PHP Code:
foreach($this->request as $key => $value)
{
    print $key."<br>";


Reasoning for this question is I have a form with quite few fields, that all I want to check is if they are is set or empty and a foreach/for loop seems to make more sense then writing out a few dozen isset()/empty() statements for each field. 

I know it can be done with the raw $_POST data but I want to do this with the inbuilt request object because of a few advantages it does offer, if at all possible.

Unless of course, there is functionality builtin that does this that I have just not seen/found yet. If that's the case, where can I find it?
Reply


Messages In This Thread
Looping over $this->request - by stlake2011 - 05-12-2020, 05:40 AM
RE: Looping over $this->request - by niklas - 05-12-2020, 08:04 AM
RE: Looping over $this->request - by jreklund - 05-12-2020, 10:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB