forked from Ahwanpradhan/SS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.php
More file actions
39 lines (39 loc) · 1.05 KB
/
Copy pathdatabase.php
File metadata and controls
39 lines (39 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
//Database connection and entry after validation
if(isset($_POST['user_submit']) and $nameErr=="" and $emailErr=="" and $mobileErr=="" )
{
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ss_registered";
$userName = $_POST['user_name'];
$userEmail = $_POST['user_email'];
$userMobile = $_POST['user_mobile'];
$userMessage = $_POST['Message'];
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO form (user_name,user_email,user_mobile,Message)
VALUES ('$userName','$userEmail','$userMobile','$userMessage')";
if ($conn->query($sql) === TRUE)
{
?>
<script>
swal("Registered Successfully!", "You can contact us for more info", "success");
</script>
<?php
}
else
{
?>
<script>
swal("Registration Error!", "You can contact us for more info", "error");
</script>
<?php
}
}
?>