Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- in your maintenance.php
- <form action="ArtworkAddForm.php" method="get">
- <br><br>
- <h1>Artwork </h1>
- <b><i>Add</i></b><br>
- Name: <input type="text" name="name"><br>
- Date: <input type="text" name="date"> <br>
- Dimensions: <input type="text" name="dimensions"><br>
- Genre: <input type="text" name="genre"><br>
- Location: <input type="text" name="location"><br>
- Colours: <input type="text" name="colours"><br>
- Price: <input type="text" name="price"><br>
- <br>
- <input type="submit" value="Add Artwork" style="font-family: 'Abel', sans-serif; font-size:20px;padding:2px; border:3px black">
- </form><br>
- ArtworkAddForm.php
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "secret";
- $dbname = "630a2i2";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $name = $_GET['name'];
- $date = $_GET['dateOfBirthDeath'];
- $placesLived = $_GET['placesLived'];
- $genre = $_GET['genre'];
- $famousWorks = $_GET['famousWorks'];
- $sql = "INSERT INTO artistTable (artistName, dateOfBirthDeath, placesLived, genre, famousWorks)
- VALUES ('$name', '$date', '$placesLived', '$genre', '$famousWorks')";
- if ($conn->query($sql) === TRUE) {
- echo "New record added successfully";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement