Click to See Complete Forum and Search --> : Javascript to HTML


Shanu.chaudhary
04-19-2008, 01:17 AM
Hi...Everyone..

Can someone tel me how to convert a javascript return value into html hidden field and further how to use that as PHP Variable.....

Is it possible??:confused:

Any help is appreciated...


Thanks in advance....

felgall
04-19-2008, 05:44 AM
If your HTML contains

<input type="hidden" id="result" name="result">

Then in your JavaScript you just assign the value you want to

document.getElementById('result').value

The name on the input field is the name of the entry in the PHP $_POST or $_GET array (depending on how the form is passed) so if the form is posted then PHP would reference it as $_POST['result']

Shanu.chaudhary
04-19-2008, 05:49 AM
Thanks for the reply...This is the first reply I got for my posts...

I am not passing the javascript value to the url....then Is there any way to use the variable in PHP???