-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave.php
More file actions
35 lines (34 loc) · 1.2 KB
/
save.php
File metadata and controls
35 lines (34 loc) · 1.2 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
<?php
include('config.php');
if(!isset($_POST['yes']) && !isset($_POST['no']) && isset($_POST['userID'])) {
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$userID = $_POST['userID'];
$sql = "UPDATE users SET firstName ='" .$firstName. "',lastName = '" .$lastName. "',email = '". $email ."',password = '" .$password. "',gender= '". $gender ."' WHERE id= " . $userID;
$query = mysql_query($sql);
header('location: index.php');
}
else if(isset($_POST['yes'])) {
$userID = $_POST['userID'];
$sql = "DELETE FROM users WHERE id= " . $userID;
$query = mysql_query($sql);
header('location: index.php');
}
else if(isset($_POST['no'])) {
header('location: index.php');
}
else {
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$sql = "INSERT INTO users (firstName, lastName, email, password, gender)
VALUES('" . $firstName ."', '" . $lastName ."', '" .$email ."', '" .$password ."', '" .$gender."')";
$query = mysql_query($sql);
header('location: index.php');
}
?>