A
A
Afafks1231321321652020-05-14 19:03:54
PHP
Afafks123132132165, 2020-05-14 19:03:54

How to change a variable when following a link?

How can you change a variable when you follow a link, well, for example, remember the file name or something like that.

<?php 
require "index3.php";
?>
<html>
<head>
    <meta charset = "utf-8">
    <title>Site</title>
</head>
<body>
    <div id = "form" align = "center">
      <p>Ваши картинки:</p>
      <?php
        $dir = $_SESSION["login"];
        $di = scandir($dir);
        $i = 0;
        while(count($di) > $i){
            if($di[$i] != "." && $di[$i] != ".."){
                echo "<a id = 'a' href = 'index7.php'>".$di[$i]."</a>"."<br>";
            }
            $i+=1;
        }
      ?>
      <a id = "a" href = "index4.php">Назад.</a>
    </div>
    <style>
        #form{
            position: fixed;
            top: 40%;
            left: 40%;
            overflow-x: auto;
            width: 200px;
            height: 117px;
            border: 1px solid black;
        }
        #a{
            text-decoration: none;
            color: black;
        }
        #a:hover{
            color: blue;
        }
    </style>
</html>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton R., 2020-05-14
@anton_reut

Forward it to the session and change it there.

T
ThunderCat, 2020-05-14
@ThunderCat

Well, that is, for example, remember the file name or something like that.
write down on a piece of paper...
$_GET, $_SESSION, $_COOKIE depending on the situation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question