-
Notifications
You must be signed in to change notification settings - Fork 0
/
index1.php
65 lines (58 loc) · 2.16 KB
/
index1.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
<?php
if (isset($_POST['submit'])) {
if (isset($_POST['fullname']) && isset($_POST['email']) &&
isset($_POST['username']) && isset($_POST['phonenumber']) &&
isset($_POST['college']) && isset($_POST['course'])&& isset($_POST['interest'])&& isset($_POST['password'])) {
$username = $_POST['fullanme'];
$password = $_POST['email'];
$gender = $_POST['username'];
$email = $_POST['phonenumber'];
$phoneCode = $_POST['college'];
$phone = $_POST['course'];
$phone = $_POST['interest'];
$phone = $_POST['password'];
$host = "localhost";
$dbUsername = "root";
$dbPassword = "";
$dbName = "test";
$conn = new mysqli($host, $dbUsername, $dbPassword, $dbName);
if ($conn->connect_error) {
die('Could not connect to the database.');
}
else {
$Select = "SELECT email FROM register WHERE email = ? LIMIT 1";
$Insert = "INSERT INTO register(fullname, email, username, phonenumber, college, course,interest,password) values(?, ?, ?, ?, ?, ?,?,?)";
$stmt = $conn->prepare($Select);
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->bind_result($resultEmail);
$stmt->store_result();
$stmt->fetch();
$rnum = $stmt->num_rows;
if ($rnum == 0) {
$stmt->close();
$stmt = $conn->prepare($Insert);
$stmt->bind_param("sssissss",$fullname, $email, $username, $phonenumber, $college, $course,$interst,$password);
if ($stmt->execute()) {
echo "New record inserted sucessfully.";
}
else {
echo $stmt->error;
}
}
else {
echo "Someone already registers using this email.";
}
$stmt->close();
$conn->close();
}
}
else {
echo "All field are required.";
die();
}
}
else {
echo "You have succesfully Registered";
}
?>