Re: Re: Passing information across pages (please ignore previous message)
| From: | Tiago Hori | Date: | Thu, 12 Mar 2015 17:18:11 +0000 |
| Subject: | Re: Re: Passing information across pages (please ignore previous message) | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324637@lists.php.net to get a copy of this message | ||
Thanks! Ian!
T.
On Thu, Mar 12, 2015 at 1:56 PM, Ian <php_list@fishnet.co.uk> wrote:
> 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
>
>
--
"Education is not to be used to promote obscurantism." - Theodonius
Dobzhansky.
"Gracias a la vida que me ha dado tanto
Me ha dado el sonido y el abecedario
Con él, las palabras que pienso y declaro
Madre, amigo, hermano
Y luz alumbrando la ruta del alma del que estoy amando
Gracias a la vida que me ha dado tanto
Me ha dado la marcha de mis pies cansados
Con ellos anduve ciudades y charcos
Playas y desiertos, montañas y llanos
Y la casa tuya, tu calle y tu patio"
Violeta Parra - Gracias a la Vida
Tiago S. F. Hori. PhD.
Ocean Science Center-Memorial University of Newfoundland