How to get JavaScript value in PHP?

How can you pass a JavaScript value into a PHP file?

  • Answer:

    JavaScript lives in the browser, PHP lives on the server. To pass a value from JavaScript to a PHP page, you can either do an HTML form submit use AJAX In both cases, the value is sent to the server and you write your PHP to handle it and send a response. The important thing is that the JavaScript value won't be available in PHP when you first generate the page, creating the page and handling the value submitted from the browser are two distinct steps.

wiki.answers.com Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.