Re: Passing information across pages (please ignore previous message)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/03/2015 15:48, Tiago Hori wrote:
<snip>

> 
> However, I have not been able to read $_POST['variable'] from within the
> php page parent.page.php. It seems to me that since the code was evaluated
> after the HTTP request I am doing something wrong where the AJAX request is
> not causing the code to be evaluated again an thus something like
> 
> if (isset ($_POST['variable'])) {
>       $array = json_decode($_POST['variable'];
>       print_r $array;
> }
> 
> does not work. I have tried many forums out there, but could not solve it.
> If anybody has any suggestion or even suggested reading, that would be
> awesome.
> 
> Jeffy,
> 
> I have a safari account so I will look at book!

Hi,

Try looking at the contents of this:

	file_get_contents('php://input');


This stackoverflow post explains why this is best for accepting JSON
from an AJAX call:

	http://stackoverflow.com/questions/8893574/php-php-input-vs-post


I use this in my JSON api without problems.

Regards

Ian
-- 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux