Href for photo open in PHP

84 Views Asked by At

I have a photo gallery, after a click on the thumbnail I want to open image but not file but another php page with this certain photo and some other stuff, how can I give link attributes that php can use from the link?

1

There are 1 best solutions below

2
On BEST ANSWER

When you ask something here, you need to explain more about your doubt and share some of the code. I don't know about the context but if you need to generate a link from an image to PHP file with parameters, you can send parameters GET and put the image in the link tag.

<a href="your_php_page.php?param1=something&param2=something">
    <img border="0" alt="Description" src="thumbnail.jpg" width="100" height="100">
</a>

your_php_page.php

<?php
(isset($_GET['param1']))? $param1 = $_GET['param1'] : $param1 = null;
?>

More about GET parameters:

  1. https://www.geeksforgeeks.org/how-to-get-parameters-from-a-url-string-in-php/
  2. https://www.php.net/manual/en/reserved.variables.get.php