Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host_ = "localhost";
- $usernameZ = "root";
- $passwordZ = "";
- $dbname = "teszter";
- $conn = new mysqli($host_,$usernameZ,$passwordZ,$dbname);
- if($conn->connect_error)
- {
- die("connectionerror");
- }
- if($_SERVER["REQUEST_METHOD"]=="POST")
- {
- $userZ = $_POST["name"]; //kiszeded a form-bol az adatokat fontos hogy az inputnak adj name="" erteket mert itt arra kell hivatkoznod
- $psdZ = $_POST["psd"];
- $user_add = "INSERT INTO proba (valami1, valami2) VALUES ('$userZ', '$psdZ')"; //megirod az sql lekerdezest
- $conn->query($user_add); //query-el futtatsz le parancsokat az adatbazison
- echo $user_add;
- }
- ?>
- <!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="index.php" method="POST">
- <label for="name">name</label>
- <input type="text" name="name" placeholder="name">
- <label for="psd">password</label>
- <input type="text" name="psd" placeholder="password">
- <input type="submit" value="POST">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment