-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
98 lines (82 loc) · 3.48 KB
/
main.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
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html>
<!-- Bootstrap CDN -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
<!----------------Include another .php file ------->
<?php include 'tables.php';?>
<!----------php code to make the title the name user submits --------->
<!----------$post = false is used for an if statement later, so the bottom title only shows AFTER A SUBMIT -------->
<?php
$title = "Charts are Love, Charts are Life";
$post = false;
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$post = true;
$title = $_POST["title"];
}
?>
<!---------------head of the file, uses php to put title on the screen -------->
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<!-------- main header, equiv. to "Bob's chart-o-matic" ------------>
<h1>
Charts are Love, Charts are Life
</h1>
<!-------------- form, a HTML way to get user input with text fields and buttons and the lot --------->
<!-------------- first one is checking the title, to see if they input a new title before they click submit --------->
<form enctype="multipart/form-data" method="post";>
Name / Title: <input type="text" name="title" value="<?php if ($title != "Charts are Love, Charts are Life") { echo $title; } ?>"> <br>
<!--------------drop down menu ---------->
Chart Type:
<select name="chartType">
<option <?php if ($_POST['chartType'] == 'None') echo 'selected="selected"';?>>None</option>
<option <?php if ($_POST['chartType'] == 'Asterisk') echo 'selected="selected"';?>>Asterisk</option>
<option <?php if ($_POST['chartType'] == 'SVG-Bar') echo 'selected="selected"';?>>SVG-Bar</option>
<option <?php if ($_POST['chartType'] == 'SVG-Line') echo 'selected="selected"';?>>SVG-Line</option>
<option <?php if ($_POST['chartType'] == 'SVG-Pie') echo 'selected="selected"';?>>SVG-Pie</option>
</select>
<br>
<!----------drop down menu ------------>
Sort By:
<select name="sortType">
<option <?php if ($_POST['sortType'] == 'None') echo 'selected="selected"';?>>None</option>
<option <?php if ($_POST['sortType'] == 'Score') echo 'selected="selected"';?>>Score</option>
<option <?php if ($_POST['sortType'] == 'First Name') echo 'selected="selected"';?>>First Name</option>
<option <?php if ($_POST['sortType'] == 'Last Name') echo 'selected="selected"';?>>Last Name</option>
</select>
<br>
<!---------textarea / box ---------->
Data:
<textarea name="gradeData" rows="5" cols="50" placeholder="Please enter the names and grades seperated by a comma..."><?php echo $_POST['gradeData'];
if (!empty(['gradeData']) && $_FILES['csvfile']['error'] == 0)
{
echo "\n";
}
if ($_FILES['csvfile']['error'] == 0)
{
echo file_get_contents($_FILES['csvfile']['tmp_name']);
}
?></textarea>
<br>
<input name="csvfile" type="file" accept=".csv"/>
<br>
<!------------ button at the end, that submits and then calls functions on the extra .php file --------->
<input type="submit" name="precious" value="Submit">
</form>
<!--------formatting a layout kinda? ---------->
<div style ="background-color: black; width=10;">
<br>
</div>
<!--------- if statement, that makes a title only show on the bottom when the user submits a title ------->
<h1>
<?php if ($post) {echo $title; } ?>
</h1>
<!----------calls function on the included .php file ----------->
<?php
display();
?>
</body>
</html>