-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprompt_write.php
More file actions
45 lines (41 loc) · 1.83 KB
/
prompt_write.php
File metadata and controls
45 lines (41 loc) · 1.83 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
<!DOCTYPE html>
<html>
<head>
<!-- bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- bootstrap icons -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css" rel="stylesheet">
<!-- my styles -->
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prompt Write - Random Notes!</title>
</head>
<body class="d-flex vh-100 flex-column">
<?php
include "helpers/confirm_or_redirect.php";
confirm_or_redirect("prompt_write");
include "helpers/top.php";
?>
<div style="background-color:#607196" class="main-content d-flex flex-grow-1 justify-content-center align-items-center">
<form method="POST" action="actions/submit_prompt.php" class="w-100">
<div class="card">
<textarea required class="form-control border-0 shadow-none" rows="6" name="prompt" id="myText" aria-describedby="prompt" placeholder="Write prompt here..."></textarea>
<div class="d-flex justify-content-between border-top p-2">
<button class="btn btn-light border-secondary rounded-pill px-4 text-muted" onclick="getRandomPrompt()" type="button"><i class="bi bi-shuffle me-2"></i>Random Prompt</button>
<button class="btn btn-success rounded-pill px-4" type="submit">Submit</button>
</div>
</div>
</form>
</div>
<script>
function getRandomPrompt() {
fetch("helpers/random_prompt.php")
.then(res => res.json())
.then(prompt => {
const p = document.getElementById("myText");
p.value = prompt;
})
}
</script>
</body>
</html>