May i know how to pass the variable from Javascript to php...
How the variable scope from javascript being assign to php variable scope?
For e.g. :
Var a; //in Javascript
$b = a;
<?
print($b);
?>
is it work?
Passing variable between PHP and Javascript
Moderator: General Moderators
You have to pass it by GET
e.g.
Then you will be able to get the variable a:-
e.g.
Code: Select all
var a = "Hello";
location.href="index.php?value="+a;Code: Select all
<?php
echo $_GETї'value'];
?>Passing variable between PHP and Javascript
not post to another new page...
passing the variable within the same page...
how the variable being passed?
I have two drop-down boxes within the same page, one after another.
The main problem here is i would like to create a new drop-down list in drop box second drop box after the onChange method is fired (in JavaScript) on the first drop box.
For example:
First box is Country and the other is state of the selected country.
if the first box is UK then the second drop box should display the state of the related country.
Both of these drop-down lists are getting from MySQL database. Thus, how can it being done?
After the onChange method, the variable is passed to Javascript and how can the variable being passed back to PHP? this is because i would like to display the drop-down list of the second drop box by using PHP-MySQL connection rather than JDBC in Javascript...
passing the variable within the same page...
how the variable being passed?
I have two drop-down boxes within the same page, one after another.
The main problem here is i would like to create a new drop-down list in drop box second drop box after the onChange method is fired (in JavaScript) on the first drop box.
For example:
First box is Country and the other is state of the selected country.
if the first box is UK then the second drop box should display the state of the related country.
Both of these drop-down lists are getting from MySQL database. Thus, how can it being done?
After the onChange method, the variable is passed to Javascript and how can the variable being passed back to PHP? this is because i would like to display the drop-down list of the second drop box by using PHP-MySQL connection rather than JDBC in Javascript...
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
it is possible to send a message back from the browser if it is dom compliant check out
http://www.dotvoid.com/article_condensed.php?itemID=9
http://www.dotvoid.com/article_condensed.php?itemID=9