-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudentSignUp.php
More file actions
26 lines (21 loc) · 1.12 KB
/
Copy pathstudentSignUp.php
File metadata and controls
26 lines (21 loc) · 1.12 KB
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
<?php
include 'dbh.php';
$correctInfo = isset($_POST["studentID"]) && !empty($_POST["studentID"]) && isset($_POST["studentFirstName"]) && !empty($_POST["studentFirstName"])
&& isset($_POST["phone"]) && !empty($_POST["phone"]) && isset($_POST["studentLastName"]) && !empty($_POST["studentLastName"]);
if ($correctInfo) {
$studentFirstName = mysqli_real_escape_string($conn, $_POST["studentFirstName"]); // index refer to the name
$studentLastName = mysqli_real_escape_string($conn, $_POST["studentLastName"]);
$studentID = mysqli_real_escape_string($conn, $_POST["studentID"]);
$phone = mysqli_real_escape_string($conn, $_POST["phone"]);
$sql = "INSERT INTO student VALUES ('$studentID', '$studentFirstName', '$studentLastName', '$phone');";
mysqli_query($conn, $sql);
echo "<br>";
echo "sign up success, please go back an log in with your new account";
} else {
echo "<br>";
echo "invalid information";
}
?>
<link href="./css/signup.css" type="text/css" rel="stylesheet">
<br>
<input type="button" value="Back" class="button" id="backbtnstudent" onClick="document.location.href='studentSignIn.php'">