Új hozzászólás Aktív témák

  • lanszelot

    addikt

    Hello

    Ez miért nem jó?
    <!DOCTYPE html>
    <html lang="en">

    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    </head>

    <body>
    <form action="index02.php" method="get">
    <label for="">username: </label><br>
    <input type="text" name="username"><br>
    <label for="">password: </label><br>
    <input type="password" name="password"><br>
    <input type="submit" value="Log in">
    </form>
    <form action="index02.php" method="post">
    <label for="">username2: </label><br>
    <input type="text" name="username2"><br>
    <label for="">password2: </label><br>
    <input type="password" name="password2"><br>
    <input type="submit" value="Log in">
    </form>
    </body>

    </html>

    <?php
    if (!empty($username) && !empty($password)) {
    echo "GET látszik az url -ben<br> Ezáltal a link bookmark -olható<br>";
    echo $_GET["username"] . "<br>";
    echo "{$_GET["password"]} <br>";
    }

    if (!empty($username2) && !empty($password2)) {
    echo "POST nem látszik az url -ben<br>Emiatt mindig az alap oldalra mutat, nem bookmark -olható<br>";
    echo $_POST["username2"] . "<br>";
    echo "{$_POST["password2"]} <br>";
    }
    ?>

    if nélkül első futásnál hibát dob, és amit nem töltök ki az is folyamatosan.
    Ezért tenném bele az if-et.

Új hozzászólás Aktív témák

Hirdetés