How can i use a simple php form in zend framework.
I am new to this framework,so please explain in detail.
Thanks in advance
See e.g.
Zend Form Quick start at the official Zend Framework documentation
Simple Zend Form Example from Rob Allen's Blog
This helped me a lot At the beginning:
http://www.zendcasts.com/zend_form-introduction-part-1/2009/02/
http://www.zendcasts.com/zend_form-introduction-part-2/2009/02/
You should use Zend Form (not PHP form), it should be standard except in some special cases.
If you really want to use plain html forms you should at least consider Zend_Filter_Input for filtering/validation the userinput.
$filters = array('body' => array('StringTrim' , 'StripTags'));
$validators = array('body' => 'Alpha');
if (!$this->getRequest()->isPost()) {
// display form;
return;
}
$input = new Zend_Filter_Input($filters, $validators, $this->getRequest()->getParams());
if (!$input->isValid()) {
// failed validation
$this->view->messages = $input->getMessages();
// redisplay form and show error messages
return;
}
// form is valid, values are filtered
echo $input->body