D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
edit_audio.php
back
Copy
<?php include "../config.php"; ?> <?php // Initialize variables $id = $english_title = $audio_filename = $image_filename = $category = $speaker = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { // Handle form submission for updating audio details $id = $_POST["id"]; $english_title = $_POST["english_title"]; $audio_filename = $_POST["audio_filename"]; $image_filename = $_POST["image_filename"]; $category = $_POST["category"]; $speaker = $_POST["speaker"]; // Establish a database connection $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Update the audio file details in the database $query = "UPDATE audio_files SET english_title = '$english_title', audio_filename = '$audio_filename', image_filename = '$image_filename', category = '$category', speaker = '$speaker' WHERE id = $id"; if ($conn->query($query) === TRUE) { echo "Record updated successfully."; } else { echo "Error updating record: " . $conn->error; } $conn->close(); } else { // Retrieve the audio file details based on the provided ID if (isset($_GET["id"])) { $id = $_GET["id"]; // Establish a database connection $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Query to select the specific audio file $query = "SELECT * FROM audio_files WHERE id = $id"; $result = $conn->query($query); if ($result && $result->num_rows > 0) { $row = $result->fetch_assoc(); $english_title = $row["english_title"]; $audio_filename = $row["audio_filename"]; $image_filename = $row["image_filename"]; $category = $row["category"]; $speaker = $row["speaker"]; } else { echo "Audio file not found."; } $conn->close(); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Edit Audio File</title> <link rel="stylesheet" href="css.css"> </head> <body> <header> <div class="logo"><img src="logo.png"></div> </header> <div class="mainbody"> <div class="bodyarea"> <div class="dextop"> <h1>Edit Audio File</h1> <form method="post" action="edit_audio.php"> <input type="hidden" name="id" value="<?php echo $id; ?>"> English Title: <input type="text" name="english_title" value="<?php echo $english_title; ?>"><br> Audio Filename: <input type="text" name="audio_filename" value="<?php echo $audio_filename; ?>"><br> Image Filename: <input type="text" name="image_filename" value="<?php echo $image_filename; ?>"><br> Category: <input type="text" name="category" value="<?php echo $category; ?>"><br> Speaker: <input type="text" name="speaker" value="<?php echo $speaker; ?>"><br> <input type="submit" value="Update"> </form> </div> </div> </div> <footer> <a href="https://webograph.pk/">Site BY Webograph.pk</a> </footer> </body> </html>