Modify $_POST in php | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Modify $_POST in php

is there a way to modify the $_post variable with php directly?

22nd Jun 2017, 5:56 PM
Stefano Trinca
Stefano Trinca - avatar
1 Answer
+ 1
by modify if you mean to set new value to $_POST you can simply assign new value to it like this: $_POST['input-name'] = 'new value'; or you can assign an associative array to $_POST: $arr = array( 'name' => 'John' , 'age' => 25 ); $_POST = $arr; $_POST['name'] // John $_POST['age'] // 25
23rd Jun 2017, 2:36 PM
Amir
Amir - avatar