How to get Html post request value in Controller?
-
14-04-2021 - |
Question
I've been trying to send the SKU of the product from the product page to another page so I can integrate it with an API.
Here's my Controller code:
For some reason I can't seem to get my SKU across so I can receive it on the other side? can someone please enlighten me as to what I'm doing wrong?
P.S. ignore comments and naming, I remove the former and change the latter later.
Solution
As I can see you did well.
As per Magento coding following are the 2 way to get post value.
- $this->getRequest()->getPostValue('monkey');
- $this->getRequest()->getPost('monkey');
Please check both the way and let me know if any.
If this helps to build your login then hit like.
Enjoy your coding!!! :)
Hiren Patel
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange