Jump to content
xisto Community
Sign in to follow this  
veerumits

Problem To Convert Javascript Variable To Php Variable

Recommended Posts

Good Morning to all of u , frnds , i have a problem to convert javascript variable to php session variable, actually i have a registration page on which user filled there form and then he click on a hyperlink suppose(add more appliances) a pop will appear on the screen on that pop-up should have username which the user filled in the begining of the form. and i have used onBlur as javascript event , and want to use session variable to transfer variable from main window to pop window.your suggessions and responses are welcomei am suffering from this problem since last 2 days and unable to solve ,the problem with me is javascript , tell me if u have any complete solution in php only.thanx in advance

Edited by veerumits (see edit history)

Share this post


Link to post
Share on other sites

It's easier to interact with PHP with AJAX. But why not send the username through the URL and retrieve the value using the _GET variable in PHP? If the script requires JavaScript enabled to work, then just go all out AJAX.

Share this post


Link to post
Share on other sites

yes wehave same problem as above.

we have a image and we have to put src of that img in session of php through onclick() event of img in javascript.

Rajesh & Girish

Share this post


Link to post
Share on other sites
Problem To Convert Javascript Variable To Php VariableProblem To Convert Javascript Variable To Php Variable

Java is run on the client, Php on the Server...Accordingly the only way to do that interaction, is to use something which both client and server do understand ... Cookies...

Just convert Java variables into cookies and let php read themĀ  or viceversa convert php variables in Cookies and let java read them.

One problem arising... Time ;-( , the conversion from Cookie to Java and Cookie to php requires that the cookie is posted, or by pressing a hyperlink or by submitting a POST / GET.

So beware in that coding you'll loose the actual cycle and get it only the next one after the post.

-reply by Quasimodo

Share this post


Link to post
Share on other sites

The only true way to get php to understand javascript is with ajax.You make javascript send an ajax request to your php script.Your problem is because php is a server-sided code. Javascript is client-sided.So php will act the same way on all computers. Javascript won't.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.