Questions about the front-end div display using php code control

Source: Internet
Author: User
The requirements for the front-end div display of php code control are as follows: Several products are dynamically read on the html page of the website. The product selection function is available. the products selected will be saved in the session and are now in the php code, you have obtained the ID saved in the session, for example, "1, 2, 3, 4 ,... "When you want to refresh the page again, the IDS that have been saved in the session will be automatically checked. hope you can master the questions about how php code controls the front-end div display.
The requirements are as follows:
Several products are dynamically read on the html page of the website. The selected product is saved in session.
Now in php code, you have obtained the saved ID in the session, for example, "1, 2, 3, 4 ,..."
When you want to refresh the page again, the IDS saved in the session will be automatically checked.
Hope that experts can provide ideas.

At present, I am confused at two points: 1. on the php code page, how to traverse the product ID in the html page and make its div style block
2. if I do this through js, how can I pass the obtained ID to js?

------ Solution --------------------
You can use js/jquery to manipulate what the div shows.

2. if I do this through js, how can I pass the obtained ID to js?

What do you mean by ID passing is that php is passed to js?

The simplest way

Echo" ";

?>

Then, use js to read the input value and then cut the character. then, operate the div block.
------ Solution --------------------
Take the value from the session and perform string cutting. then you can use jquery ajax to upload the value to js for display processing, or var a = '<% = session ("aaa ") %> '; the session aaa value is set to "1, 2, 3, 4, 5, 6, 7, 8", and then you split the display in javascript.

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.