Page 1 of 1

php & javascript

Posted: Thu Feb 19, 2009 1:09 pm
by dheeraj
hello guys, i had just totally sink to the problem of initializing value of one javascript variable to php variable....

Suppose, i have a form element having id toy, & i get its value as follows...

Code: Select all

var toy=document.getElementById("toy").value
now i want to assign the value of toy to any of php variable, but i m unable to do it,plz anyone help..

thanks

Re: php & javascript

Posted: Thu Feb 19, 2009 1:15 pm
by papa
You can't unless you send the variable to another page or reload the page with a form.

The php code is rendered before javascript.