Get email from html form and delete it in database inphp

Viewed 33

I'm student and I'm new to php and mysql. Please help me with this. Can you correct these codes and help me with your answers.
This is my html form :

<html>
    <head>
        <title>
            Subscribe
        </title>
    </head>
    <body>
        <form method="post" action="delete-subs.php">
Email:<input type="Text" id="semail" name="semail"><br>
<input type="Submit" name="submit" value="delete">
    </body>
</html>

This is delete-subs.php :

<html>
 
<head>
   <title>Delete subscribe</title>
</head>
 
<body>
    <center>
        <?php
 include'db/config.php';
        $semail = $_REQUEST['semail'];
$sql = "DELETE FROM sbscribers WHERE semail=$email";

if ($conn->query($sql) === TRUE) {
  echo "<h1 style='color: red;'>Thank you</h1><br>Successfully deleted.";
} else {
  echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
        ?>
    </center>
</body> 

When I click the button nothing appears, no errors and nothing; please help me.
0 Answers
Related