Set phps $_REQUEST['variable_name'] in JavaScript

后端 未结 4 726
轮回少年
轮回少年 2021-01-21 20:00

is it possible to store a variable through javascript so that I can read it in php using $_REQUEST[\'variable_name\'].

for eg. let\'s say i have

$adcat         


        
4条回答
  •  自闭症患者
    2021-01-21 20:38

    Does this make any sense? Is this possible?

    Yes, you need to bind it to the request string.

    If you're calling foobar.php, change the onsubmit behavior of the form and make it:

    'foobar.php?category_id=' + your_javascript_category_id_value
    

提交回复
热议问题