-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_pref_update.php
More file actions
63 lines (42 loc) · 1.56 KB
/
Copy pathuser_pref_update.php
File metadata and controls
63 lines (42 loc) · 1.56 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
require_once("functions.php")
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Van Street Eats</title>
<link href="css/normalize.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Domine|Josefin+Sans&display=swap" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
</head>
<body>
<!-- header section -->
<header class="box-head box">
<?php
include("header.php");
include("navmenu.php");
?>
</header>
<?php
$connection;
$result;
openConnection($connection);
getUser($connection, $result);
$user = mysqli_fetch_array($result);
editUser($connection, $result, $user);
//confirmation message displaying the name of the newly registered user
echo "<div class=\"centered\"<p>Thanks for registering</p>".$_POST['name']."</div>";
closeConnection($connection, $result);
?>
</body>
</html>
<!-- functions -->
<?php
//function to register user calling the function to perform query
function editUser(&$connection, &$result, &$user) {
$updateQuery = "UPDATE users SET fullname = \"".$_POST["name"]."\", email = \"".$_POST["email"]."\", e_pref = \"".$_POST["ePref"]."\", f_pref = \"".$_POST["fPref"]."\" WHERE username = \"".$user["username"]."\";";
// echo $updateQuery; for debugging and figuring out what insert queries require
performQuery($connection, $result, $updateQuery); //now perform the query
}
?>