-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaddnote.php
72 lines (59 loc) · 2.59 KB
/
addnote.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
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
64
65
66
67
68
69
70
71
72
<?php ob_start();?>
<? session_start();?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
<style> body{background-color: grey;} </style>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="header">
<div id="logo">
<a href="profile.php"><img src="images/logo.png"/></a>
<a href="logout.php" style="float: right; padding: 10px; margin-right: 40px; background-color:#3CB371; color:white; border-radius: 5px;text-decoration: none;font-weight: bold;">Logout<a/>
<a href="index.php" style="float: right; padding: 10px; margin-right: 10px; background-color:#3CB371; color:white; border-radius: 5px;text-decoration: none;font-weight: bold">Home<a/>
<a href="profile.php" style="float: right; padding: 10px; margin-right: 10px; background-color:#3CB371; color:white; border-radius: 5px;text-decoration: none;font-weight: bold">Profile</a>
<a href="contact.php" style="float: right; padding: 10px; margin-right: 10px; background-color:#3CB371; color:white; border-radius: 5px;text-decoration: none;font-weight: bold">Contact</a>
</div>
</div>
<br/>
<p>Hi,<?php echo $_SESSION['username'];?></p>
<div class="container">
<?php
require_once "includes/db.php";
$note = "";
if(isset($_POST['submit'])){
$note = $_POST['note'];
}
if(strlen($note) < 3){
// echo '<br/><div class="alert alert-danger">Please add a note</div>';
}else{
$add_note = "INSERT INTO notes (note) VALUES ('$note')";
if(mysqli_query($conn,$add_note)) {
echo '<br/><div class="alert alert-success">Note has been saved in your dashboard</div>';
}else{
echo "add your note";
}
}
mysqli_close($conn);
?>
<div class="row">
<div class="col-sm-7">
<div class="table-responsive">
<h2 style="color: maroon;">Add note</h2>
<p>The form below contains a textarea for adding note to your workout plan:</p>
<form method="post" action="">
<div class="form-group">
<label for="note">Add note:</label>
<textarea class="form-control" rows="8" id="note" name="note"></textarea>
<button type="submit" name="submit">Submit</button>
</div>
</form>
</div></div></div></div>
</body>
</html>