How can i get javascript variable to store in php? -


this question has answer here:

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

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -