Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <center>
- <h1>FORMULARZ BAZODANOWY</h1>
- <p>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "dane";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "CREATE DATABASE dane";
- if (mysqli_query($conn, $sql)) {
- echo "Database created successfully";
- } else {
- echo "Error creating database: " . mysqli_error($conn);
- }
- echo "<p>";
- $sql = "CREATE TABLE osobowe (
- id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
- imie VARCHAR(30) NOT NULL,
- nazwisko VARCHAR(30) NOT NULL,
- wiek INT(3),
- pesel INT(11),
- reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
- )";
- if ($conn->query($sql) === TRUE) {
- echo "Table Osobowe created successfully";
- } else {
- echo "Error creating table: " . $conn->error;
- }
- $conn->close();
- ?>
- <form action="" method="post" enctype="text/plain">
- Podaj swoje imię: <input name="imie"><br>
- Podaj swoje nazwisko: <input name="nazw"><br>
- Podaj swoj wiek: <input name="wiek"><br>
- Podaj swoje PESEL: <input name="pesel"><br>
- <input type="submit" value="Wyślij formularz">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement