简体   繁体   中英

How can I pass data from one page to another in PHP and Javascript without from?

How can I pass data from one page to another page in PHP using Javascript without from?

In my blog have a post comment with email Id and this is routing using foreach loop problem occur when get email id and comment how can i do this? plz help

you can make use of client side cookie for this. one page you create cookie and on second page read that cookie.

I guess that what you dislike with forms is the page reloading on the client side. If that is the case then you can use ajax requests (maybe with the help of a framework like jQuery, or pure javascript with the xmlHTTPRequest() ).

Alternatively you can use cookies, but it's not what they really are for.

If you don't mind the page reloading, you can also use HTTP GET requests with javascript :

location.assign("http://www.my_site.com/index.php?param1=value1&param2=value2");

You can also store data in Web storage if the data doesn't necessarily need to be processed in PHP.

You will need to have a backup system in cookies though for the older browsers that do not support his.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM