I have a Javascript function that saves the value from checked input from a div in an array. And I want to pass this array to PHP. Is it possible? And if it is, how can I do?
Asked
Active
Viewed 253 times
-3
-
4Use jquery ajax to pass a js variable to php – Manish Jangir May 20 '13 at 14:00
1 Answers
1
You cannot pass variable values from the current page javascript to the current page PHP code since PHP runs in the server and it cannot know what is going on on the client side.
You may use different methods to get a response from the server using javascript variables, such as AJAX or dynamic server calls. Here's an example how to do it.

Niche
- 967
- 5
- 23
-
-
actually it's possible if he uses stringify() then json_decode() in php, but with a button or something otherwise it's not possible for dynamic variables – Yosra MH Jan 22 '21 at 12:34