Pergunta

I tried every possible thing get when I using the get method it works fine but post does not send any value. using this in my controller.

$post = $this->getRequest()->getPostValue();

but got a empty array. form content

$controller_path = $block->getUrl('module name/activate');
           <form method="post" id="form1" name="form1"  action="<?php echo $controller_path;?>" >
                <p><b><span style ="color:#14497f";>Please confirm your email address:</span></b>
                <input type="email" placeholder="Admin email address" style =" margin-left:5px;" size="30"  name="email" /><b>
                <input type="submit" name="submit" class="button" style ="margin-left:2px;background: #14497f none repeat scroll 0% 0%;border-color: #14497f;color: #FFF;" value="Proceed to the final step">
Foi útil?

Solução

You can try

$this->getRequest()->getParams();

You can access specific parameter by

$this->getRequest()->getParam('something');

Post form action

<form id="yotpo-form" action="<?php echo $block->getFormActionUrl() ?>" method="post">
    <?php echo $block->getBlockHtml('formkey')?>
    <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
    <input id="app_key" type="text" value="<?php echo $block->_config->getAppKey();?>" class="
</form>

Inside your Block

public function getFormActionUrl()
{
    return $this->getUrl('feedback/index/post', ['_secure' => true]);
}

Make sure your Back end controller extend Magento\Backend\App\Action I tested in my controller, those are working fine. if not working there is something went wrong in posting.

Fell free to share your code if not working, hope this helps.

Outras dicas

I have faced same problem ago

I got blank array in post due to some misconfiguration of .htaccess rule

I will suggest you changed your .htaccess with fresh one

may be it helpful to you

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top