View Full Version : how we can take $_post variable in javascript code???

06-26-2009, 06:23 AM
Hello all ,

I have two forms. one in which i will fill value & after submitting

this $_Post['value'] , this value will go in to the next page.

But i need this value on next page in my javascript code also .

when i use this value in javascript by storing it in a variable "abc"

like :-

var abc="<?php echo $_POST['adult']; ?>";


then it shows in alert the script "<?php echo $_POST['adult']; ?>";

rather than the value of php variable stored .

please suggest me some solution regarding these so that the JS alert shows

the value of php variable stored , rather than the php script used .

Thanks & Regards.

06-26-2009, 12:25 PM
not sure but what if you do it without the quotes


var abc=<?php echo $_POST['adult']; ?>;


06-26-2009, 05:07 PM
Thread cross posted here: http://www.dynamicdrive.com/forums/showthread.php?t=46251