Why we use the $this->getRequest()->isPost()

For programming and general questions on Zend Framework

Why we use the $this->getRequest()->isPost()

Postby deshmukhmahesh on Wed Nov 07, 2012 8:22 am

Hi Everyone,

I am new in zend could you please explain why we use the $this->getRequest() and $this->getRequest()->isPost(),
I have tried with out using $this->getRequest()->isPost() in my action but is was not working, hence please clear my doubts

---
Regards,
MD
deshmukhmahesh
 
Posts: 5
Joined: Mon Aug 29, 2011 1:14 pm

Re: Why we use the $this->getRequest()->isPost()

Postby facingwest on Wed Nov 07, 2012 2:46 pm

I'm no expert but i'll try and answer your question since nobody else has.

the $this->getRequest() is doing exactly what it says. Each time a page is loaded in the browser it is first requested by the browser and the web server serves it up. In Zend you can grab that object (header call?) and there are a number of methods that can be used. You can do a number of different things with the request at that point. The $this->getRequest()->isPost() is checking to see if the requesting browser (user) has submitted a form in this particular request, if they have then it returns true and if it hasn't then it returns false. Also you can use $this->getRequest()->getParams() to get the post and get parameters of that request.

Here are the methods that can be called on $this->getRequest()

clearParams()
getActionKey()
getActionName()
getControllerKey()
getControllerName()
getModuleKey()
getModuleName()
getParam($key, $default)
getParams()
getUserParam($key, $default)
getUserParams()
isDispatched()
setActionKey($key)
setActionName($value)
setControllerKey($key)
setControllerName($value)
setModuleKey($key)
setModuleName($value)
setParam($key, $value)
setParams($array)


Hope this helps!
facingwest
 
Posts: 18
Joined: Fri Sep 23, 2011 4:46 pm

Re: Why we use the $this->getRequest()->isPost()

Postby deshmukhmahesh on Thu Nov 08, 2012 2:37 pm

Hi facingwest ,

Thanks ! now I got it clearly.

---
Regards,
MD
deshmukhmahesh
 
Posts: 5
Joined: Mon Aug 29, 2011 1:14 pm


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 6 guests