forked from Prakash4844/Dressingnity-Ecommerce-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_member.php
35 lines (29 loc) · 1.05 KB
/
save_member.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
<?php
//starting the session
session_start();
//including the database connection
require_once 'conn.php';
if(ISSET($_POST['register'])){
// Setting variables
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
// Insertion Query
$query = "INSERT INTO `member` (email, username, password, firstname, lastname) VALUES(:email ,:username, :password, :firstname, :lastname)";
$stmt = $conn->prepare($query);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':password', $password);
$stmt->bindParam(':firstname', $firstname);
$stmt->bindParam(':lastname', $lastname);
// Check if the execution of query is success
if($stmt->execute()){
//setting a 'success' session to save our insertion success message.
$_SESSION['success'] = "Successfully created an account";
//redirecting to the index.php
header('location: Register.php');
}
}
?>