Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am new to php. I did a little search but did not find a good solution. So posting the question here.

I have several thumbnail images in my webpage. Something like:

 <img src="" id="thumb1">
 <img src="" id="thumb2">
 <img src="" id="thumb3">
 <img src="" id="thumb4">

I want to call load a php file when a user clicks on any of these thumbnail images and pass the id of the image to the php file. This php file queries the database with the image id and displays the relevant information. So far I used "form action" to call a php file.

Can you please tell me how to call php file and pass the image id?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
322 views
Welcome To Ask or Share your Answers For Others

1 Answer

Use links:

<a href="php_file.php?id=thumb1"><img src="" id="thumb1"></a>
<a href="php_file.php?id=thumb2"><img src="" id="thumb2">/a>
<a href="php_file.php?id=thumb3"><img src="" id="thumb3">/a>
<a href="php_file.php?id=thumb4"><img src="" id="thumb4">/a>

php side: $_GET['id'];


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...