CI4 add value to post array |
In CI3 if I needed to add a value to the received post array, I could do:
PHP Code: $_POST['keyValue'] = value;
(04-20-2022, 06:19 AM)serialkiller Wrote:(04-20-2022, 01:10 AM)datamweb Wrote: Hi, use Oh!!, I realized. You must use the following code: Code: $rQ=\Config\Services::request();
What are you trying to do?
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
(04-20-2022, 11:11 AM)datamweb Wrote:(04-20-2022, 06:19 AM)serialkiller Wrote:(04-20-2022, 01:10 AM)datamweb Wrote: Hi, use It doesn't work, it just returns that value, I need all the values in post plus an addition (04-21-2022, 01:23 AM)ignitedcms Wrote: What are you trying to do? In a controller I receive the data in post and I need to add a value to the post array
Quote:In a controller I receive the data in post and I need to add a value to the post array I get that, but I was wondering why? Normally once you have the post data you pass it off to a model for evaluation. If you wanted to add another arbitrary value you could do so and then pass it off to a model, perhaps you could give us a little bit more background information so we can help?
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
First of all, you do not need to use superglobals in your code.
It is considered a bad practice, and you should not do it. But if you really want to use $_POST, you could use it and it works in CI4. PHP Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |