t3hmadhatt3r Posted May 28, 2009 Share Posted May 28, 2009 I am trying to get javascript variables using only php. I'm not sure if this is possible but, If it is help will be very, very appreciated. This should explain what I'm trying to do: <?php $data = javascript:data; ?> I know the above code doesn't work. It's just a explanation. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 28, 2009 Share Posted May 28, 2009 Without GET or POST, not that I know of. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted May 28, 2009 Share Posted May 28, 2009 PHP lives on the server, JavaScript lives on the client. The only way the client sends information to the server is via HTTP requests; an HTTP request always has a URL and can optionally have GET or POST data. Therefore if you want to send data from JavaScript to PHP (i.e. from client to server), then you must make an HTTP request (using XHR). Your request can put the information anywhere you'd like it to be: 1) The URL 2) GET 3) POST Your PHP script should grab the data from wherever your JavaScript placed it; if you'll need it in a future PHP script request, then look at storing it in a SESSION. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.