-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
87 lines (84 loc) · 2.38 KB
/
signup.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<title>Car Purchasing</title>
<link rel="stylesheet" type="text/css" href="style/reset.css">
<link rel="stylesheet" type="text/css" href="style/responsive.css">
</head>
<body>
<section class="">
<?php
include 'header.php';
?>
<section class="listings">
<div class="wrapper">
<h3>Signup Here</h3>
<form method="post">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="name" required></td>
</tr>
<tr>
<td>Phone Number:</td>
<td><input type="text" name="phone" required></td>
</tr>
<tr>
<td>Email Address:</td>
<td><input type="email" name="email" required></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" required></td>
</tr>
<tr>
<td>Gender:</td>
<td>
<select name="gender">
<option> Male </option>
<option> Female </option>
<option> Other </option>
<option> Prefer Not To Specify </option>
</select>
</td>
</tr>
<tr>
<td>Address:</td>
<td><input type="text" name="address" required></td>
</tr>
<tr>
<td colspan="2" style="text-align:right"><input type="submit" name="save" value="Submit Details"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['save'])){
include 'connection.php';
$name = $_POST['name'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$qry = "INSERT INTO customers (Password,Phone_number,Name,Address,Email_Address,Gender)
VALUES('$password','$phone','$name','$address','$email','$gender')";
$result = $conn->query($qry);
if($result == TRUE){
echo "<script type = \"text/javascript\">
alert(\"Successfully Registered.\");
window.location = (\"login.php\")
</script>";
} else{
echo "<script type = \"text/javascript\">
alert(\"Registration Failed. Try Again\");
window.location = (\"signup.php\")
</script>";
}
}
?>
</ul>
</div>
</section>
</section>
</body>
</html>