-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchooseevent.php
159 lines (151 loc) · 6.46 KB
/
chooseevent.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
154
155
156
157
158
159
<html>
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" />
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<link href="adminpagecss.css" rel="stylesheet">
<script>
$( function() {
$( "#accordion" ).accordion();
} );
</script>
<link rel="stylesheet" href="adminpagecss.css">
</head>
<body>
<div id="wrapper" class="container-fluid">
<div class="row">
<nav class="sidebar col-2 bg-faded sidebar-style-1">
<h1 class="navbar-brand">
<a href="#"><strong>Kreiva</strong></a>
</h1>
<ul class="nav nav-pills flex-column sidebar-nav">
<li class="nav-item">
<a href="userpage.php" class="nav-link">Dashboard</a>
</li>
<li class="nav-item">
<a href="trial_events2.php" class="nav-link">Events</a>
</li>
<li class="nav-item">
<a href="chooseevent.php" class="nav-link">Register</a>
</li>
</ul>
<a href="user_logout.php" class="logout-button">
<em class="fa fa-lock"></em>
Signout
</a>
</nav>
<main class="col-10 ml-auto">
<header class="page-header row">
<div class="col-md-6 col-lg-8">
<h1 class="display-4">Choose Events</h1>
</div>
</header>
<form method="post" action="chooseevent.php">
<?php
error_reporting(0);
session_start();
$con=mysqli_connect("localhost","root","","eventmanage");
$email=$_SESSION['login_user'];
echo '<h3>Welcome '. $email .'</h3>';
$dbName = 'trial';
$conn =mysqli_connect("localhost","root","","trial");
$res = "SHOW TABLES FROM $dbName";
$result=mysqli_query($conn,$res);
$topic1 ="";
$topic2 ="";
$topic3 ="";
$topic4 ="";
//$submit=0;
if ($result)
{
?>
<div id="accordion">
<?php
while ($row = mysqli_fetch_assoc($result))
{
$currTable = $row['Tables_in_'.$dbName];
?>
<h3>
<?php echo ucwords($currTable) ;?>
</h3>
<div>
<?php
$res2 = "SELECT * FROM $currTable";
$run=mysqli_query($conn,$res2);
?>
<div class="form-check">
<label class="form-check-label">
<input checked type='radio' name='mydisc' class="form-check-input" value="<?php echo $currTable ;?>"><?php echo ucwords($currTable) ;?><br>
</label>
</div>
<?php
$count = 0;
while ($user = mysqli_fetch_assoc($run))
{
?>
<label for="checkbox-1">
<input type="checkbox" value= "<?php echo $user['list']; ?>" name="artlist[<?php echo $count;?>]"> <?php echo ucwords($user['list']);?><br>
</label>
<?php
$count += 1;
}
?>
<br>
<input class="btn btn-dark" type="submit" name="submit" value="Submit">
</div>
<?php
}
?>
</div>
<?php
echo '</ul>';
}
$email="";
$topic1 ="";
$topic2 ="";
$topic3 ="";
$topic4 ="";
$dbName = 'trial';
$conn =mysqli_connect("localhost","root","","trial");
$con=mysqli_connect("localhost","root","","eventmanage");
$res = "SHOW TABLES FROM $dbName";
$result=mysqli_query($conn,$res);
//echo $_SESSION['login_user'];
if(isset($_POST["submit"]))
{
if(isset($_POST["artlist"]))
{
//$email=$_SESSION['user_name'];
$email= $_SESSION['login_user'];
$event = $_POST["mydisc"];
$topic1 = $_POST['artlist'][0];
$topic2 = $_POST['artlist'][1];
$topic3 = $_POST['artlist'][2];
$topic4 = $_POST['artlist'][3];
if (!$con)
{
die("Connection failed: " . mysqli_connect_error());
}
$sql= "INSERT INTO " .$event. " (email, event1, event2, event3, event4) VALUES ('$email', '$topic1','$topic2','$topic3','$topic4')";
if(mysqli_query($con,$sql))
{
echo 'Data added successfully';
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
}
}
?>
</form>
</main>
</div>
</div>
</body>
</html>