![]() |
Multi-dimensional Array in POST - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Multi-dimensional Array in POST (/showthread.php?tid=93027) |
Multi-dimensional Array in POST - Gian - 06-16-2025 Hi, I make an AJAX request in POST to CI, sending some data, including some data in the format: Code: const args: { If I print $this->request->getPost(), I display: PHP Code: Array( but if I try to print $this->request->getPost(field1.field2) I always get an empty value. Am I wrong in the declaration? RE: Multi-dimensional Array in POST - InsiteFX - 06-16-2025 The provided code snippet has a syntax error in TypeScript because it's trying to use a type annotation where a value assignment is expected. Code: const args: { "field1": { "field2": string } } = { RE: Multi-dimensional Array in POST - Gian - 06-17-2025 I thank you for the reply InsiteFX. I do not use TypeScript in the current development environment but VanillaJS. For fetching the data in CI, I solved by assigning the main array to a variable and then parsing the various keys. RE: Multi-dimensional Array in POST - InsiteFX - 06-17-2025 Ok, glad you got it working. |