-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.php
More file actions
54 lines (47 loc) · 1.47 KB
/
submit.php
File metadata and controls
54 lines (47 loc) · 1.47 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$name = $_POST['name'];
$email = $_POST['email'];
$website = $_POST['website'];
$comment = $_POST['comment'];
$gender = $_POST['gender'];
// Database connection
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "myntra";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Insert query
$sql = "INSERT INTO user (name, email, website, comment, gender)
VALUES ('$name', '$email', '$website', '$comment', '$gender')";
?>
<!DOCTYPE html>
<html>
<head>
<title>Form Submission Result</title>
</head>
<body>
<?php
if (mysqli_query($conn, $sql)) {
echo "<h2>✅ New record created successfully!</h2>";
echo "<h3>Submitted Information:</h3>";
echo "<ul>";
echo "<li><strong>Name:</strong> " . htmlspecialchars($name) . "</li>";
echo "<li><strong>Email:</strong> " . htmlspecialchars($email) . "</li>";
echo "<li><strong>Website:</strong> " . htmlspecialchars($website) . "</li>";
echo "<li><strong>Comment:</strong> " . htmlspecialchars($comment) . "</li>";
echo "<li><strong>Gender:</strong> " . htmlspecialchars($gender) . "</li>";
echo "</ul>";
} else {
echo "<h3>❌ Error: " . $sql . "<br>" . mysqli_error($conn) . "</h3>";
}
mysqli_close($conn);
?>
</body>
</html>