-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
38 lines (27 loc) · 840 Bytes
/
insert.php
File metadata and controls
38 lines (27 loc) · 840 Bytes
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
<?php
$servername = "localhost";
$username = "root";
$password = "mysql";
$dbname = "f20160250db";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$First_Name=$_POST['First_Name'];
$Last_Name=$_POST['Last_Name'];
$address=$_POST['address'];
$age=$_POST['age'];
$city=$_POST['city'];
$Number_of_Cars=$_POST['Number_of_Cars'];
$Mobile_Number=$_POST['Mobile_Number'];
$sql = "INSERT INTO Users
(First_Name, Last_Name, Address, Age, City, Number_of_Cars, Mobile_Number)
VALUES ('$First_Name','$Last_Name','$address','$age','$city',
'$Number_of_Cars','$Mobile_Number')";
if ($conn->query($sql) === TRUE) {
header("location: welcome.php");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>