-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd.php
More file actions
52 lines (44 loc) · 1.39 KB
/
add.php
File metadata and controls
52 lines (44 loc) · 1.39 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
<?php
include 'includes/connection.php';
session_start();
if(!isset($_SESSION['nick_name'])){
header("Location: login.php");
}
$alert = array();
if(isset($_POST['submit'])){
$name = $_POST['name'];
$note = $_POST['note'];
$id = $_SESSION['id'];
$insert_query = mysqli_query($conn, "INSERT INTO notes VALUES('', '$id', '$name','$note', CURRENT_TIMESTAMP)");
header("Location: notes.php?alert=added");
}
?>
<!DOCTYPE html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0 ,maximum-scale=1">
<head>
<meta charset="UTF-8">
<title>your Notes App</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<nav>
<div>
<h2 class="big-hero-text"><?php echo ucfirst($_SESSION['nick_name']). " ";?>Notes App</h2>
</div>
</nav>
<h1 class="h1">Add Notes <a href="notes.php"><i class="fa fa-undo" aria-hidden="true"></i></a></h1>
<div id="form" class="form form1 ">
<form action="add.php" method="POST">
<h2 class="name">Name</h2>
<input class="input" type="text" name="name" required>
<br><br>
<h2 class="name">Note</h2>
<textarea class="texarea" name="note" required></textarea>
<br>
<input class="input" id="button" type="submit" name="submit" value="Add note">
</form>
</div>
</body>
</html>