Unable to capture POST data from simple form

Permalink
Hi. I have a custom block that worked fine with 5.6, that I am updating to work with 5.7.5.13. In the view is a simple form:
<form name="set1" id="set1" method="post" action="/adults/booking-test?xa=2">
 <input name="f_class" type="hidden" value="1">
 <select class="form-control" name="items" id="items">
   <option value="0">0</option>
   <option value="1">1</option>
 </select>
 <input name="ref" type="hidden" value="144276">
</form>

In the controller I am dumping the php REQUEST superglobal:
public function view() {
   echo var_dump($_REQUEST).'<br>xa='.$_REQUEST['xa'].'<br>ref='.$_REQUEST['ref'].'<br>this->post='.$this->post('ref');
   [snip]

I get this:
array(1) { ["xa"]=> string(1) "2" }
xa=2
ref=
this->post=

None of the posted data is contained within $_REQUEST or $this->post('ref'). I've tried changing the input name. I've tried using $_POST. I tried everything I can think of. Can anyone tell me what I'm missing please?

 
hutman replied on at Permalink Best Answer Reply
hutman
Try doing something like this

<form name="set1" id="set1" method="post" action="<?php echo $view->action('submit')?>">
    <input name="xa" type="hidden" value="2">
    <input name="f_class" type="hidden" value="1">
    <select class="form-control" name="items" id="items">
        <option value="0">0</option>
        <option value="1">1</option>
    </select>
    <input name="ref" type="hidden" value="144276">
</form>

The in the controller
public function view()
{
}
public function action_submit($bID = false)
{    
    if ($this->bID == $bID) {
        echo 'xa = '.$this->post('xa').'<br />';
        echo 'f_class = '.$this->post('f_class').'<br />';
        echo 'items = '.$this->post('items').'<br />';
        echo 'ref = '.$this->post('ref').'<br />';
        $nh = Core::make('helper/navigation');
        $this->redirect($nh->getLinkToCollection(Page::getCurrentPage()), 'submit_success');
    }
}
public function action_submit_success(){
losttheplot replied on at Permalink Reply
Brilliant - thanks for such a quick and detailed response. Before asking, I had carried out what I thought was a thorough search of the net and the c5 docs, but I obviously didn't look in the right places because I couldn't find anything along the lines of what you have just illustrated.
hutman replied on at Permalink Reply
hutman
Unfortunately I can't really send you to a good place for documentation, the documentation is kind of a mess right now.