Actually the problem was with my page settings. If someone wants to link a php file to another php file by anchor tag (a href=”https://wordpress.stackexchange.com/questions/239574/….”) and wants to send some data through URL, he/she must has to make the targeted php file a page template. Like this
<?php
/***
Template Name: Gallery
***/
Then he/she has to create a new page from the dashboard with this page template. Only after this process the link will work properly.
I didn’t create the page from dashboard.