-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatientSignupSQL.php
More file actions
44 lines (30 loc) · 1.13 KB
/
patientSignupSQL.php
File metadata and controls
44 lines (30 loc) · 1.13 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
session_start();
require_once('php/db_functions/db_connect.php');
// check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$phoneNumber = $_POST['phoneNumber'];
$dateOfBirth = $_POST['dateOfBirth'];
$gender = $_POST['gender'];
$postCode = $_POST['postCode'];
$address_ = $_POST['address_'];
$patientPassword = ($_POST['patientPassword']);
$hashed_password = password_hash('patientPassword', PASSWORD_DEFAULT);
$conn = makeConnection();
$created = false;
//insert data into users table
$stmt = $conn->prepare("INSERT INTO patient (firstName, lastName, email, phoneNumber, dateOfBirth, gender, postCode, address_, patientPassword) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param('sssssssss', $firstName, $lastName, $email, $phoneNumber, $dateOfBirth, $gender, $postCode, $address_, $hashed_password);
$stmt->execute();
//the logic
if ($stmt) {
$created = true;
}
$stmt->close();
$conn->close();
header('Location: patientLogin.php');
exit;
}