我的通讯表格需要帮助
form.php
<?php
include 'connect.php';
?>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<h3>Subscribe to our Mailing list</h3>
<form action="add.php" method="post" id="embed-form" >
Your Name..
<input type="text" name="name" id="name" placeholder="Your Name"><br>
Your Email..
<input type="email" name="email" id="email" placeholder="Your Email"><br>
<input type="submit" name="submit" id="submi" value="Subscribe">
<span id="success-message" class="email-success"</span>
</form>
</body>
</html>
Connect.php
<?php
$conn=mysqli_connect("localhost","root","","subscriber");
//Check Connection
if(mysqli_connect_errno()){
echo "Failed to connect to MySqli";
mysqli_connect_errno();
}
?>
add.php
<?php
include 'connect.php';
if(isset($_POST['name'])&& isset($_POST['email'])){
$n=$_POST['name'];
$e=$_POST['email'];
$s=$_POST['submit'];
$query=("INSERT INTO newsub (name, email) VALUES ('$n','$e')");
$result=mysqli_query($conn,$query);
$result=mysqli_query($conn,$query);
echo "Thank you for your subscription";
}
?>