简体   繁体   中英

Different row on different page with same session data

I have MySQL table with 4 rows ( id, name, age, tel ) and I want on the first page to dosplay all NAMEs and once a user click on one of the name to go to different page showing NAME and AGE (using the id row) and a button to third page showing NAME AGE TEL. I know it is using sessions but I don't exactly how to write it

You can make use of $_GET . In your first page create a link to the the second page with an url like:

secondpage.php?id=1

Where 1 is the id of that particular row. Then In your second page you can get this id from the url using $_GET['id']. Then retrieve the row with this id value; do a MySQL query to retrieve the values to be shown. Do the same for the third page.

name1

name2

name3

if you click on name1 than

<a herf="showall.php?id=<?php echo $row['id'];?>">name1</a>

it will to showall.php page and fetch data of id=1 it on another page

this may helpful!

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