Viewing file: add.php (970 B) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include 'connect.php'; ?>
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { $title = $_POST['title']; $description = $_POST['description']; $link = $_POST['link']; $image = $_FILES['image']['name'];
move_uploaded_file($_FILES['image']['tmp_name'], "images/" . $image);
$sql = "INSERT INTO why_itce (title, description, image, link) VALUES ('$title', '$description', '$image', '$link')"; $conn->query($sql); header("Location: index.php"); } ?>
<h2>Add New Record</h2> <form method="post" enctype="multipart/form-data"> <label>Title:</label><br> <input type="text" name="title" required><br><br>
<label>Description:</label><br> <textarea name="description" required></textarea><br><br>
<label>Link:</label><br> <input type="text" name="link" required><br><br>
<label>Image:</label><br> <input type="file" name="image" required><br><br>
<input type="submit" value="Add"> </form>
|