-
Notifications
You must be signed in to change notification settings - Fork 0
/
userinfo.php
31 lines (25 loc) · 715 Bytes
/
userinfo.php
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
<?php
$servername = "localhost";
$username = "phpmyadmin";
$password = "Admin@123";
$dbname = "fitness";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$user = $_POST['username'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$comment = $_POST['comment'];
$sql = "INSERT INTO userdata (user, email, mobile, comments)
VALUES ('$user' , '$email' , '$mobile' , '$comment')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
header('location:index.php');
?>