<form class="form" id="perguntas-form" action="<?php echo $this->getUrl("hello/index/index")?>" method="post" autocomplete="off">
Hey guys,
I have this on my form on:
hello\view\adminhtml\templates\biperguntas_index_index.phtml
Im trying to get the post values from the form on:
Hello\Controller\Adminhtml\Index\Index.php
Why is this not working?
Thanks
Solved! Go to Solution.
Seems like you are missing formkey to pass.
below is the code to pass the formkey to controller !
<input name="form_key" type="hidden" value="<?php /* @escapeNotVerified */ echo $block->getFormKey(); ?>" />
After passing formkey , check in your controller you will able to get the post values over there !!
In your controller get post value like below :
$PostValue = $this->getRequest()->getPost();
print_r($PostValue);
Hope it helps
You can get form post value using controller by below way,
$getPost = $this->getRequest()->getPost(); var_dump($getPost);
Using above way you can get array of your form data in controller.
Seems like you are missing formkey to pass.
below is the code to pass the formkey to controller !
<input name="form_key" type="hidden" value="<?php /* @escapeNotVerified */ echo $block->getFormKey(); ?>" />
After passing formkey , check in your controller you will able to get the post values over there !!
In your controller get post value like below :
$PostValue = $this->getRequest()->getPost();
print_r($PostValue);
Hope it helps
You can get form post value using controller by below way,
$getPost = $this->getRequest()->getPost(); var_dump($getPost);
Using above way you can get array of your form data in controller.
Thank you mate,
that helped a lot
What about saving data?