Hello, i have an element of type Radio in zend form . how can i get value of radio button on form post.
keep in mind i am using Zend Form
if ($this->_request->isPost()) {
if ($form->isValid($_POST)) {
$values = $form->getValues();
}
}
i am already doing the above code it is really correct way to get values of posted elements but for radio button it only posts the last value of that radio button. for example: my radio button is like
$type = array("0"=>"0", "1"=>"1", "2"=>"2")
// add Order element
$order = $this->CreateElement('Radio', 'order');
$order->setMultiOptions( $type );
$elements[] = $order;
then after post it always returns : order = 2
On the other hand, if i use the same code while json = False like:
// ------------------------------------------------
// prepare the form for ProductInfo
// ------------------------------------------------
$productinfo = new Form_ProductInfo();
$this->view->productinfo = $productinfo;
$this->view->productinfo->setAction($this->view->url());
$this->view->jsonEncoded = false;
then it works fine & pick selected radio button value.