-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewvote.php
153 lines (131 loc) · 5.93 KB
/
newvote.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
session_start();
ob_start();
include "koneksi.php";
include "functions.php";
$tampildat =mysqli_query($conn, "SELECT * FROM user WHERE id='$_SESSION[id]'");
$dat =mysqli_fetch_array($tampildat);
$id = $dat['id'];
$tablevote = mysqli_query($conn, "SELECT * FROM tabl$id");
if( isset($_POST['create']) ){
if(newvote($_POST) > 0 ){
echo "
<script>
alert('Vote create success!');
document.location.href = 'vote.php';
</script>
";
}else{
echo "
<script>
alert('Vote create failed!');
document.location.href = 'newvote.php';
</script>
";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&family=Raleway:wght@100;200;300;400;500;700&family=Ubuntu:ital,wght@0,400;0,500;1,300;1,400;1,500&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/4ef2c70460.js" cross origin="anonymous"></script>
<title>VoteIt!</title>
<style>
body{
font-family: 'PT Sans', sans-serif;
line-height: 1.6;
background-color: rgb(38, 38, 38);
}
.nav-link{
color: rgb(0, 0, 0);
transition: 0.2s ease-in-out 0s;
text-decoration: none;
}
.nav-link:hover{
color: rgb(250, 139, 2);
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg bg-white" style=" width: 100%; margin: auto; font-size:20px;">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mx-auto fw-bold">
<li class="nav-item">
<a class="nav-link" href="home.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="vote.php">Vote</a>
</li>
<li class="nav-item">
<a class="nav-link" href="search.php">Search</a>
</li>
</ul>
</div>
</div>
</nav>
<img src="img/robek-atas.png" alt="" style="width: 100%; height: 40px; margin: 0; padding: 0;">
<h1>New vote data</h1>
<div class="bg p-4 mb-5 mt-2 text text-left text-white border border-light" style="width:75%; margin: auto;">
<div class="container">
<form action="" method="post" enctype="multipart/form-data" autocomplete="off">
<div class="datainput">
<input type="hidden" name="id">
<div class="form- ">
<div>
<p class="text-danger">NOTE : DON'T USE A SPACE, AND YOU CANNOT CHANGE THE VOTE NAME IF IT'S ALREADY CREATED</p>
<label for="votename">Vote name :</label>
</div>
<input type="text" name="votename" id="votename"
class="form-control" aria-describedby="helpId" required>
<br><br>
</div>
<h1>Option</h1>
<p class="text-danger">NOTE : THIS IS ONLY THE FIRST OPTION, YOU CAN ADD OTHER OPTIONS IN THE VOTE TABLE OPTION LATER</p>
<div class="d-flex flex-wrap justify-content-between">
<div class="form- m-3" style="width: 40%;">
<div>
<label for="noopt">No :</label>
</div>
<input type="text" name="noopt" id="noopt"
class="form-control" aria-describedby="helpId" required>
<br><br>
</div>
<div class="form- m-3" style="width: 40%;">
<div>
<label for="optyon">Option name :</label>
</div>
<input type="text" name="optyon" id="optyon"
class="form-control" aria-describedby="helpId" required>
<br><br>
</div>
<div class="form- m-3" style="width: 40%;">
<div>
<label for="gambar">Photo :</label>
</div>
<input type="file" name="gambar" id="gambar"
class="form-control" aria-describedby="helpId" required>
<br><br>
</div>
</div>
<br>
<button class="btn btn-outline-light" type="submit" name="create">Create!</button>
</form>
</div>
</div>
</div>
<img src="img/robek-bawah.png" alt="" style="width: 100%; height: 40px; margin: 0; padding: 0;">
<div class="footer p-3 bg-white text-black text-center ">
<p>© Kelompok15 2022, all right reserved</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
</body>
</html>