i am new to php and zend framework, pls help me to solve this problem.
i am trying to construct a registration form using zend, on click of the submit button the control go's to the action but $this->_request->isPost() returns false and status code not found is seen when checked in the network option of the crome browser.
controller
public function firstAction()
{
$request = $this->getRequest();
//die("inside first");
Zend_Debug::dump($this->_request->isPost());
//Zend_Debug::dump($indexForm->isValid($this->getRequest()->getPost()));
//send the url after the form action
$options =array("actionUrl"=>'/index/first',"header"=>'test');
//connecting the form and the view
$indexForm2 = new Application_Form_Login($options);
//$page = $this->_request->getParam('page');
if(($this->getRequest()->isPost())){
if ($indexForm2->isValid($request->getPost()))
{
$regvalues=$this->getAllParams();
$modleinsert= new Application_Model_First(); //Create a modele object
$testreg= $modleinsert->getRegInsert($regvalues);
$testreg=1;
if($testreg)
{
$_SESSION['echo'] = "Saved successfully";
}
else
{
$_SESSION['echo'] = "Please try again";
}
}
}
$this->view->indexForm2 = $indexForm2;
}
FORM CODE
<?php
class Application_Form_Login extends Zend_Form
{
public function init($options=NULL)
{
//form
$this->setAttrib("horizontal", true);
$this->removeDecorator("DtDdWrapper");
$this->setAction($options['actionUrl']) //controler name and action name(function name)
->setMethod('post')
->setName('form');
/*$this->setAttribs(array('horizontal'=> true,'method'=>'post'))
->setAction($options['actionUrl'])
->setName('Calendar');*/
/* First Name*/
$this->addElement("text", "txtName", array(
"required" => true,
"label" => "First Name",
'filters' => array('StringTrim'),
// "size"=>"10",
'validators' => array(array('NotEmpty', true, array('messages' => 'Please enter first name')))));
//Last Name
$this->addElement("text", "txtLastName", array(
"required" => true,
"label" => "Last Name",
'filters' => array('StringTrim'),
'validators' => array(array('NotEmpty', true, array('messages' => 'Please enter last name')))));
//district... dropdown
$district=new Application_Model_First();
$disList=$district->getDistrictsList(); //obtain the list of districts from db.
$this->addElement("select", "ddlDistrict", array(
"required" => true,
"label" => "District",
'filters' => array('StringTrim'),
'MultiOptions'=>$disList,
'validators' => array(array('NotEmpty', true, array('messages' => 'Please enter district name')))));
//Register button
$this->addElement("submit", "Submit", array("label" => "Submit"));
}
}