How to solve the $ _ SESSION transmission between pages

Source: Internet
Author: User
$ _ SESSION transmission between pages $ _ SESSION ['id'] = $ I [id];? & Gt; & lt; a & nbsp; href = "B. php? & Lt ;? Php & nbsp; echo & nbsp; $ I ['id']? & Gt; "& gt; & lt; img & nbsp; src =" $ _ SESSION transmission between img pages
$ _ SESSION ['id'] = $ I [id];?>

">
. Jpg "/>


$ I contains 10 messages,
Click any image and print it to the B page through $ _ SESSION.
How can I select the image to be clicked and print the ID of the image? session: ">
------ Solution --------------------
If you only want to GET the image ID, you can pass the parameter through the GET method, instead of the SESSION. The SESSION is on the server side. you click the image on the client side, the server cannot know which image you click or change the SESSION by clicking the object, unless you pass the parameter.
Write it like this.
Id = ">

Page B:
Echo $ _ GET ['id'];
------ Solution --------------------
$ _ SESSION [$ I [id] = $ I [id];?>

">
. Jpg "/>


B. php
Session_start ();
$ Id = $ _ GET ['id'];
Echo $ _ SESSION [$ id];

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.