-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
110 lines (80 loc) · 2.61 KB
/
registration.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
include "config.php";
?>
<!DOCTYPE html>
<html>
<head>
<title>User Registration | PHP</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" >
<link rel="stylesheet" href="style2.css" />
</head>
<body>
<div class="form">
<div class="container-fluid bg">
<div class="row justify-content-center">
<div class="col-12 col-sm-offset-6 col-md-3">
<form action="registration.php" method="post" class="signup-form" >
<div class="form-group">
<h1>Registration</h1>
<p>Fill up the form with correct values.</p>
<hr class="mb-3">
<label for="firstname"><b>First Name</b></label>
<input class="form-control" id="firstname" type="text" name="firstname" required>
<label for="lastname"><b>Last Name</b></label>
<input class="form-control" id="lastname" type="text" name="lastname" required>
<label for="email"><b>Email Address</b></label>
<input class="form-control" id="email" type="email" name="email" required>
<label for="phonenumber"><b>Phone Number</b></label>
<input class="form-control" id="phonenumber" type="text" name="phonenumber" required>
<label for="password"><b>Password</b></label>
<input class="form-control" id="password" type="password" name="password" required>
<hr class="mb-3">
<input class="btn btn-primary btn-block" type="submit" id="register" name="create" value="Sign Up">
</div>
</div>
</div>
</div>
</form>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
<script type="text/javascript">
$(function(){
$('#register').click(function(e){
var valid = this.form.checkValidity();
if(valid){
var firstname = $('#firstname').val();
var lastname = $('#lastname').val();
var email = $('#email').val();
var phonenumber = $('#phonenumber').val();
var password = $('#password').val();
e.preventDefault();
$.ajax({
type: 'POST',
url: 'process.php',
data: {firstname: firstname,lastname: lastname,email: email,phonenumber: phonenumber,password: password},
success: function(data){
Swal.fire({
'title': 'Successful',
'text': data,
'type': 'success'
<?php
header("Location: /index.php");
?>
})
},
error: function(data){
Swal.fire({
'title': 'Errors',
'text': 'There were errors while saving the data.',
'type': 'error'
})
}
});
}else{
}
});
});
</script>
</body>
</html>