-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_project.php
90 lines (83 loc) · 3.38 KB
/
add_project.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
session_start();
// Redirect to login page if user is not authenticated
if (!isset($_SESSION['username'])) {
header('Location: login.php');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add Project</title>
<link rel="stylesheet" href="css/add_project.css?rnd=@Function.SessionID">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat&family=Open+Sans&display=swap" rel="stylesheet">
</head>
<body>
<main>
<div class="container">
<div class="prompt-container">
<h1>Add a project</h1>
<form action="add_project_process.php" method="POST">
<input type="text" name="project_name" id="project_name" placeholder="Project Name..." required>
<textarea name="project_description" id="project_description" placeholder="Project Description..."
required></textarea>
<label for="start_date">Start Date:</label>
<input type="date" name="start_date" id="start_date" required>
<label for="end_date">End Date:</label>
<input type="date" name="end_date" id="end_date" required>
<label for="dev_phase">Current Development Phase:</label>
<select name="dev_phase" id="dev_phase" required>
<option value="" disabled selected>Select a phase</option>
<option value="design">Design</option>
<option value="development">Development</option>
<option value="testing">Testing</option>
<option value="deployment">Deployment</option>
<option value="complete">Complete</option>
</select>
<?php
echo "<button type=\"submit\">Add Project to database as " . $_SESSION['username'] . ".</button>";
?>
</form>
</div>
</div>
</main>
<footer>
<div class="logo-container">
<a href="index.php">
<img src="img/ap.svg" alt="logo">
</a>
</div>
<div class="footer-text">
<span>©2023 M Kalam | 220064521@aston.ac.uk</span>
</div>
</footer>
<script>
// Validate start and end dates
var startDate = document.getElementById('start_date');
var endDate = document.getElementById('end_date');
var startChangedOnce = false;
startDate.addEventListener('change', function () {
if (!startChangedOnce) {
endDate.value = startDate.value + 1;
startChangedOnce = true;
return;
}
if (startDate.value > endDate.value) {
alert('Start date must be before end date.');
startDate.value = '';
}
});
endDate.addEventListener('change', function () {
if (startDate.value > endDate.value) {
alert('End date must be after start date.');
endDate.value = '';
}
});
</script>
</body>
</html>