Pass Javascript variable value to php variable

We can use variable value in JavaScript in PHP, but we can not directly use value in client side (JavaScript) in server side PHP.

how to pass javascript variable value to php

How to pass JavaScript variable value to PHP

Here is simple solution to use value in client side (JavaScript) variable in server side PHP varaible :

we need to pass values in JavaScript to server side using location.href JavaScript function in the url……

location.href=”blog_app.php?name=” +name;

Here is example code

note : create single blog_app.php php file, add following sample codes to test this.

 

 

 

Subscribe to get all tutorial updates, promotional offers and download links for all tutorials via E-Mail

Enter your email address:



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">