Re: Can $_POST variables be modified in a function?



Kevin Audleman schreef:
Hello,

I'm working with a web store package which gives me specific places
where I can insert my code. I am trying to modify $_POST variables
after a form is submitted, and before the store actually processes
them. This is within a class function. Problem is, any $_POST variable
I modify is disappearing from the end result. I don't know if there's
a warning being thrown that the web store is suppressing or what, but
it's my modification of the values that seems to be screwing things
up. I came across a post in the PHP documentation that mentioned
something about superglobals not being able to be modified in
variables, but gave no solution. Does anybody know what the deal is,
and how I might be able to modify my $_POST variables?

Thanks,
Kevin

Hi Kevin,

You can modify the $_POST array just as you like.
You must make a mistake elsewhere.

Here is an example that shows that:
----------------------------------------
Post before:
<br>
<pre>
<?php print_r($_POST); ?>
</pre>

<?php
$_POST["test"] = "bla";
?>
<hr>
after:
<br>
<pre>
<?php print_r($_POST); ?>
</pre>
----------------------------------------

How are you reposting the data? Via Curl?

Regards,
Erwin Moller
.



Relevant Pages