D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
edit_speaker.php
back
Copy
<?php include "../config.php"; ?> <!DOCTYPE html> <html> <head> <title>Edit Speaker</title> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <link href="css/style.css" rel="stylesheet"> <link href="css.css" rel="stylesheet"> <link href="audio/css.css" rel="stylesheet"> </head> <body> <h1>Edit Speaker</h1> <?php // Check if the speaker ID is provided in the URL if (isset($_GET['spid'])) { $spid = $_GET['spid']; // Create a connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } if ($_SERVER["REQUEST_METHOD"] == "POST") { // Retrieve form data $spname = $_POST['spname']; // Update the speaker name $update_query = "UPDATE speakers SET spname = ? WHERE spid = ?"; $stmt = $conn->prepare($update_query); $stmt->bind_param("si", $spname, $spid); if ($stmt->execute()) { echo "Speaker updated successfully!"; } else { echo "Error updating speaker: " . $stmt->error; } $stmt->close(); } // Query to retrieve the current speaker name $query = "SELECT spname FROM speakers WHERE spid = $spid"; $result = $conn->query($query); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $spname = $row['spname']; } $conn->close(); } ?> <form method="post" action="edit_speaker.php?spid=<?php echo $spid; ?>"> <label for="spname">Speaker Name:</label> <input type="text" name="spname" value="<?php echo $spname; ?>" required> <input type="submit" value="Update"> </form> </body> </html>