0

I made page whith a table, the table has fictional store names in each row, and when I press a store then it redirects me to another page. I would like to send the store name to the second page file, called stores_info.php. This is my code for the first page, called stores.php:

    <table class='table'>
        <thead>
            <tr>
            <th>name</th>
            </tr>
        </thead>
        <tbody>
            <?php
            foreach ($stores as $store) {
                echo '<tr> <td><a href="store_info.php?store=$store">'.$store[0].'</a></td> </tr>'; 
            }
            ?>
        </tbody>
    </table>

And this is the code I´m writing for stores_info.php, where I'm trying to print the store name I pressed before in the page:

   <?php
if(isset($_GET["store"]))
{
    $data = $_GET["store"];
    
}
    echo($data)
    ?>

The page shows the following output instead of the name of the fictional store:

    $store 

¿How can get the output I want?

0 Answers0