How can i get javascript variable to store in php? -
this question has answer here:
- how pass javascript variables php? 12 answers
i see 1 example in pass javascript variable php this:
<html> <head> <script type="text/javascript"> var q = "hello"; <?php $ff ="<script>document.write(q1)</script>"; ?> </script> </head> <body> <?php echo $ff; ?> <input type="hidden" value="nis" id="val"> </body> </html>
i try 1 exaple this:
<html> <head> <script type="text/javascript"> var q = $("#val").val(); <?php $ff ="<script>document.write(q)</script>"; ?> </script> </head> <body> <?php echo $ff; ?> <input type="hidden" value="nis" id="val"> </body> </html>
but not give output. there solution problem? how can value in php variable? want "nis" in $ff variable.
pl. try code <html> <head> <script type="text/javascript"> var q=document.getelementbyid("val").value; //document.write(q); </script> </head> <body> <input type="hidden" value="nis" id="val"></body> <script type="text/javascript"> var q=document.getelementbyid("val").value; document.write(q); </script> <?php echo $ff="<script type='text/javascript'> document.write(q)</script>"; ?> <?php echo $ff; ?> </html>
Comments
Post a Comment