-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
62 lines (60 loc) · 2.07 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
<?php session_start() ?>
<div class="container-fluid">
<form action="" id="signup-frm">
<div class="form-group">
<label for="" class="control-label">Firstname</label>
<input type="text" name="first_name" required="" class="form-control">
</div>
<div class="form-group">
<label for="" class="control-label">Lastname</label>
<input type="text" name="last_name" required="" class="form-control">
</div>
<div class="form-group">
<label for="" class="control-label">Contact</label>
<input type="text" name="mobile" required="" class="form-control">
</div>
<div class="form-group">
<label for="" class="control-label">Address</label>
<textarea cols="30" rows="3" name="address" required="" class="form-control"></textarea>
</div>
<div class="form-group">
<label for="" class="control-label">Email</label>
<input type="email" name="email" required="" class="form-control">
</div>
<div class="form-group">
<label for="" class="control-label">Password</label>
<input type="password" name="password" required="" class="form-control">
</div>
<button class="button btn btn-info btn-sm">Create</button>
</form>
</div>
<style>
#uni_modal .modal-footer{
display:none;
}
</style>
<script>
$('#signup-frm').submit(function(e){
e.preventDefault()
$('#signup-frm button[type="submit"]').attr('disabled',true).html('Saving...');
if($(this).find('.alert-danger').length > 0 )
$(this).find('.alert-danger').remove();
$.ajax({
url:'admin/ajax.php?action=signup',
method:'POST',
data:$(this).serialize(),
error:err=>{
console.log(err)
$('#signup-frm button[type="submit"]').removeAttr('disabled').html('Create');
},
success:function(resp){
if(resp == 1){
location.href ='<?php echo isset($_GET['redirect']) ? $_GET['redirect'] : 'index.php?page=home' ?>';
}else{
$('#signup-frm').prepend('<div class="alert alert-danger">Email already exist.</div>')
$('#signup-frm button[type="submit"]').removeAttr('disabled').html('Create');
}
}
})
})
</script>