Re: how i assign a js variable to a php variable

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

 




On Sep 17, 2009, at 2:43 PM, Andrea Giammarchi wrote:



I have to disagree Ash, you can pass js variable values to PHP but only through a page load. Then you could use $_REQUEST, $_POST, $_GET to retrieve
it. I have done this before.

And I am sure Ash does it on daily basis, the problem is the used therm: I want to *assign* ... not pass, assign!

I am quite sure that is what he meant, since I cannot count people reading <?php ?> in the middle of the page thinking it can interact directly with nodes and javascript, and being "a new one", I think Ash replied in the correct way.

Regards

All true, and probably appropriate to clarify the relationship between php and js.

However, if the goal is to pre-set something in php land so you don't have to pass it with your next page navigation, you could use ajax to to pass the value to a simple php script that in turn updates a php session variable, so that it is already set when you do your next real page load.

You would still be "calling a page" technically, but your current displayed page would remain in place and php would have the value available on its next page load.


--
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