Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Gitarowe wojny - Dodaj swój najlepszy wynik</title>
- <link rel="stylesheet" type="text/css" href="style.css" />
- </head>
- <body>
- <h2>Gitarowe wojny - Dodaj swój najlepszy wynik</h2>
- <?php
- if (isset($_POST['submit'])) { // POCZĄTEK
- $name = $_POST['name'];
- $score = $_POST['score'];
- if (!empty($name) && !empty($score)) {
- $dbc = mysqli_connect('www.guitarwars.net', 'admin', 'rockit', 'gwdb'); // KONIEC
- $query = "INSERT INTO guitarwars VALUES (0, NOW(), '$name', '$score')";
- mysqli_query($dbc, $query);
- echo '<p>Dziękujemy za dodanie rekordu!</p>';
- echo '<p><strong>Imię i nazwisko:</strong> ' . $name . '<br />';
- echo '<strong>Wynik:</strong> ' . $score . '</p>';
- echo '<p><a href="index.php"><< Wróć do listy rekordów</a></p>';
- $name = "";
- $score = "";
- mysqli_close($dbc);
- }
- else {
- echo '<p class="error">Wpisz wszystkie informacje, aby ' .
- 'dodać swój najlepszy wynik.</p>';
- }
- }
- ?>
- <hr />
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
- <label for="name">Imię i nazwisko:</label>
- <input type="text" id="name" name="name" value="<?php if (!empty($name)) echo $name; ?>" /><br />
- <label for="score">Wynik:</label>
- <input type="text" id="score" name="score" value="<?php if (!empty($score)) echo $score; ?>" />
- <hr />
- <input type="submit" value="Dodaj" name="submit" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement