Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="container" >
- <form action="upload.php" method="POST" enctype="multipart/form-data" style="background-color: #D26969; height: 55%; width: 300px;">
- <input type="text" name="Category" placeholder="Category" autocomplete="off" style="width: 185px; height: 40px; padding: 5px; margin-top: 10px; margin-left: 50px; position:relative;" /><br/><br/>
- <!--<input type="text" name="img-name" placeholder="File Name" autocomplete="off" style="width: 185px; height: 20px; padding: 5px; margin-top: 10px; margin-left: 50px; position:relative;"/><br/><br/>-->
- <input type="text" name="Caption" placeholder="Caption" autocomplete="off" style="width: 185px; height: 40px; padding: 5px; margin-top: 10px; margin-left: 50px; position:relative;"/><br/><br />
- <input type="file" name="imgfile" style="width: 185px; margin-left: 50px;" /><br/> <br/>
- <input type="submit" name="action" value="Upload" style="margin-left: 170px; height: 30px; padding: 5px; border-radius: 3px; background: #27a465; color: #f7f7f7; border: none;">
- </form>
- </div>
- <div class="container-two">
- <ul>
- <? php
- //code to display the list
- ?>
- </ul>
- </div>
- include(connect.php);
- $Category=$_POST['Category'];
- $Caption=$_POST['Caption'];
- $File =( $_FILES['imgfile']['name']);
- mysqli_query("INSERT INTO images (Category, Caption, Img_dir) VALUES
- ('$Category', '$Caption', '$File')") ;
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $database = "schedios";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $database);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
Add Comment
Please, Sign In to add comment