Submit custom form in Magento 2.3 admin
Your controller should extend Magento\Backend\App\Action and implements Magento\Framework\App\Action\HttpPostActionInterface, also don't forget about ACL.
So should look something like this:
namespace Vendor\Module\Controller\Adminhtml\Folder;
class NewFunction extends \Magento\Backend\App\Action implements \Magento\Framework\App\Action\HttpPostActionInterface
{
/**
* Authorization level of a basic admin session
*
* @see _isAllowed()
*/
public const ADMIN_RESOURCE = 'Magento_Cms::save';
public function execute()
{
$params = $this->getRequest()->getParams();
//OR
$name = $this->getRequest()->getParam('hello');
}
}
Also don't forget about form_key input, your view should look like:
<form action="<?php echo $block->getNewFunctionUrl()?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="form_key" value="<?= $block->getFormKey() ?>">
<input type="text" name="hello"/>
<input type="submit" value="Submit" />
</form>