There is a slider that displays different stores. Stores are added through the admin area. In this slider there are several shops with a title, a photo and an address. But there are no links to any store. I have a page (template) where the store should be completely visible, when I click on the store title in the slider. There are 3 columns in the database: id, title, address. title, address. I vivel. Now, as I understand it, you need to use $_GET[] to pass the parameters. What do I write in the url of the link (store header) <a href="?stores&id=<?=$stores['id'] ?>"><h3 class="title"><?= $stores['title']?></h3></a> stores <a href="?stores&id=<?=$stores['id'] ?>"><h3 class="title"><?= $stores['title']?></h3></a> ? stores & id = I used to make some websites on the VP and there when creating for example a new category or similar, the url is created automatically. Now I’m using the url http://prntscr.com/d4m477, which is the get parameter stores and id. How to display on a separate page, exactly the store I click on?

Shl. ?stores&id= get pairs always need to be entered manually, starting from the logic of the names of where we want to go to this address?

    1 answer 1

    First you have to check if there is something in $ _GET

     $stores = (isset($_GET['id'],$_GET['stores ']) ? intval($_GET['id']) : false); if($stores){ //Тут мы уже знаем что пользователь запрашивает магазин, но мы не можем быть уверены, пока ты не отправишь запрос. // "SELECT * FROM название таблицы WHERE `id` = '".$stores."'" ->fetch() } 

    Write what you use to work with the database (PDO, Own, etc., mb some kind of engine you use (I will help to rewrite for your specific solution))

    Since I don’t know how your code is organized, I can’t say exactly how best to organize a separate page for your store. Please show a piece of the page on which it will be possible to understand how everything is organized with you.

    • Thank you, my own samopny engine, I use mysql to connect to the database, I don’t use OOP yet. - Arthur Chereshnyuk
    • Show the page code, I will help to implement - lazyproger
    • Here's the code for sandbox.onlinephpfunctions.com/code/… - Arthur Chereshnyuk
    • Look at the top set the condition, and in it we get the store. sandbox.onlinephpfunctions.com/code/… - lazyproger
    • Thanks, I'll take a look. - Arthur Chereshnyuk