-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup_form.php
147 lines (126 loc) · 4.68 KB
/
signup_form.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
include('dbcon.php');
if (isset($_POST['submit'])){
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$middlename=$_POST['middlename'];
$age=$_POST['age'];
$gender=$_POST['gender'];
$address=$_POST['address'];
$email=$_POST['email'];
$contact_no=$_POST['contact_no'];
$username=$_POST['username'];
$password=$_POST['password'];
$cpassword=$_POST['cpassword'];
if($cpassword!=$password){
$a="Password do not Match";
}else{
$a = "";
}
}
?>
<form method="post">
<div class="span5">
<div class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputEmail">Name</label>
<div class="controls">
<input type="text" name="firstname" value="<?php if (isset($_POST['submit'])){echo $firstname;} ?>" placeholder="Firtname" required>
<input type="text" name="lastname" value="<?php if (isset($_POST['submit'])){echo $lastname;} ?>" placeholder="Lastname" required>
<input type="text" name="middlename" value="<?php if (isset($_POST['submit'])){echo $middlename;} ?>" placeholder="Middlename" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Gender</label>
<div class="controls">
<select name="gender" required>
<option><?php if (isset($_POST['submit'])){echo $gender;} ?></option>
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Age</label>
<div class="controls">
<input name="age" class="span1" type="number" value="<?php if (isset($_POST['submit'])){echo $age;} ?>" placeholder="Age" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Username</label>
<div class="controls">
<input type="text" name="username" value="<?php if (isset($_POST['submit'])){echo $username;} ?>" placeholder="Username" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Password</label>
<div class="controls">
<input type="password" name="password" value="<?php if (isset($_POST['submit'])){echo $password;} ?>" placeholder="Password">
</div>
</div>
<div class="control-group">
<div class="controls">
<button name="submit" type="submit" class="btn btn-info"><i class="icon-signin icon-large"></i> Sign Up</button>
</div>
</div>
</div>
</div>
<div class="span6">
<div class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputPassword">Address</label>
<div class="controls">
<input type="text" name="address" value="<?php if (isset($_POST['submit'])){echo $address;} ?>" placeholder="Address" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Contact No</label>
<div class="controls">
<input type="text" name="contact_no" value="<?php if (isset($_POST['submit'])){echo $contact_no;} ?>"placeholder="Contact No" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Email Address</label>
<div class="controls">
<input name="email" type="text" value="<?php if (isset($_POST['submit'])){echo $email;} ?>" placeholder="Email Address" required>
</div>
</div>
<?php
if(isset($_POST['submit']))
{
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$middlename=$_POST['middlename'];
$age=$_POST['age'];
$gender=$_POST['gender'];
$address=$_POST['address'];
$email=$_POST['email'];
$contact_no=$_POST['contact_no'];
$username=$_POST['username'];
$password=$_POST['password'];
$cpassword=$_POST['cpassword'];
if( $password == $cpassword){ ?>
<?php
mysqli_query($conn,"insert into members (firstname,lastname,age,gender,address,email,contact_no,username,password)
values ('$firstname','$lastname','$age','$gender','$address','$email','$contact_no','$username','$password')
")or die(mysqli_error($conn));?>
<script type="text/javascript">
window.location='success.php';
</script>
<?php
}else{
echo " ";
}}
?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Confirm Password</label>
<div class="controls">
<input type="password" name="cpassword" value="<?php if (isset($_POST['submit'])){echo $cpassword;} ?>" placeholder="Confirm Password" required>
<?php if (isset($_POST['submit'])){?> <span class="label label-important"><?php echo $a; ?></span><?php }?>
</div>
</div>
</div>
</div>
</form>