Skip to content
● Critical PHP security fixes are out: update PHP on your Grav sites. What to do →

Access POST variable inside plugin

Solved by Ole Vik View solution

Started by Geroge Stamoulis 8 years ago · 2 replies · 996 views
8 years ago

Is there a way to access the $_POST variable from within a plugin? I don't want to use the official forms plugin just for one simple task... I've tried $this->grav['uri']->post() because I saw it in the source code of the official plugin and an unknown function error. I also tried $this->grav['twig']->twig_vars['post'] = $_POST; and I get null!

8 years ago Solution

I usually just use $_POST in PHP and pass to Twig as needed. Is that not sufficient for your implementation?

8 years ago

Unfortunately the problem was in my request implementation 🙄
Thanks for taking the time to answer though.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by DrPen, 2 days ago
2 81 2 hours ago
Plugins · by renedebaaij, 1 week ago
1 134 3 days ago
Plugins · by Thomas, 6 days ago
1 144 5 days ago
Plugins · by complanar, 4 weeks ago
6 471 3 weeks ago
Plugins · by BenLaKnet, 3 weeks ago
1 294 3 weeks ago