-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathtsignup.php
52 lines (46 loc) · 1.45 KB
/
tsignup.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
<?php
//$connect = mysqli_connect($servername, $username, $password $nameofthetablewhereuserinfoistobesubmitted);
// $connect = mysqli_connect('localhost', 'root', '', 'class_db');
include('dbcon.php');
if(isset($_POST['submit']))
{
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$pword = $_POST['pass'];
$cpword = $_POST['cpass'];
$sel = mysqli_query($connect, "SELECT * FROM teacher_tb WHERE email ='$email' ");
$res = mysqli_num_rows($sel);
if (empty($fname))
{
echo "<h3 style='color:red;'>Firstname field is empty </h3>";
}
elseif ($res == 1) {
echo "<h3 style='color:red;'>Email already exists</h3>";
}
else if (empty($lname))
{
echo "<h3 style='color:red;'>Lastname feild is empty</h3>";
}
else if (!filter_var($email,FILTER_VALIDATE_EMAIL))
{
echo "<h3 style='color:red;'>Email field is incorect </h3>";
}
else if (empty($email))
{
echo "<h3 style='color:red;'>Email field is empty </h3>";
}
else if ($pword !== $cpword) {
echo "<h3 style='color:red;'>Password Mismatch</h3>";
}
else{
mysqli_query($connect, "INSERT INTO teacher_tb(firstname,lastname,email,password) VALUES ('$fname','$lname','$email','$pword')");
header("location:TeacherRegister.html") ;
echo "<h3 style='color:red;'>Registration Sucess</h3>";
}
}
else
{
echo"<h3 style='color:red;'>Registration UnSucessful</h3>";
}
?>