Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Access POST variable inside plugin

Solved by Ole Vik View solution

Started by Geroge Stamoulis 7 years ago · 2 replies · 722 views
7 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!

7 years ago Solution

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

7 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 Rene, 1 week ago
2 46 1 week ago
Plugins · by Xavier, 4 weeks ago
2 55 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1181 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 49 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 73 2 months ago