forked from Metis-IITGN/SignUpFormHTML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
90 lines (60 loc) · 2.09 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
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
<!-- session_start(); -->
<html>
<body>
<?php
/*
$name=$_POST["name"];
$email=$_POST["email"];
$roll=$_POST["roll"];
$course=$_POST["course"];
$password=$_POST["password"];
$password2=$_POST["password2"];
*/
/*for storing it in the particular session*/
/*
$_SESSION["name"]=$name;
$_SESSION["email"]=$email;
$_SESSION["roll"]=$roll;
$_SESSION["course"]=$course;
$_SESSION["password"]=$password;
$_SESSION["password2"]=$password2;
*/
/**********************************************************************************************/
/* DEFINING FIXED VALUES AND STORING THE DATA TO DATABASE */
/**********************************************************************************************/
$name='Ashim';
$email='[email protected]';
$roll='14110021';
$course='XYZ';
$password='mypasskey';
$password2='mypasskey';
$datastore="mydatabase";
$conn = new mysqli('localhost', 'root', '', $datastore);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// $sql = "INSERT INTO MyGuests (firstname, lastname, email) VALUES ('John', 'Doe', '[email protected]')";
$sql = "INSERT INTO registered_users (Name,Email,RollNo,Course,Password) VALUES ('$name','$email','$roll','$course','$password')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
/*
else
{ mysqli_query($datastore,"INSERT INTO registered_users(Name,Email,RollNo,Course,Password) VALUES ($name,$email,$roll,$course,$password)");
echo "<h1>VERIFICATION PAGE</h1>";
echo "Name:".$name."<br>";
echo "Email:".$email."<br>";
echo "Roll No:".$roll."<br>";
echo "Course:".$course."<br>";
echo "Password:".$password."<br>";
/*redirecting to the welcomepage*/
// echo "Get through to the<a href='welcomepage.php'> WORLD OF SHARING</a>";
// }
// mysqli_close($datastore);
?>
</body>
</html>