I need help in getting the value of the radio button and using it as a variable in php cake controller.
<li class="search-pref-list-items__item"><label><input type="radio" name="pref" value="1">a</label></li>
<li class="search-pref-list-items__item"><label><input type="radio" name="pref" value="2">b</label></li>
<li class="search-pref-list-items__item"><label><input type="radio" name="pref" value="3">c</label></li>
I already tried $this->request->data but it only works on textbox, $_GET[] and $_POST[] are also now working
how will I do this?
Hi Rey Norbert Besmonte,
You need to create radio buttons by following cakephp method. Please refere my code as below to create radio button by following cakephp framework standard.
$options = array('a'=>'1','b'=>'2','c'=>'3');
$attributes = array('div' => 'input', 'type' => 'radio', 'options' => $options,'class' => 'search-pref-list-items__item' ,'default' => '1');
echo $this->Form->radio('Filed Name',$attributes);
So you need to remove from your code and place above code.
Hope this will help you.