-
Notifications
You must be signed in to change notification settings - Fork 1
/
applydelegate.php
717 lines (619 loc) · 45.9 KB
/
applydelegate.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" type="image/x-icon" href="img/plismun19_a_favicon.png">
<title>Delegate Application – PLISMUN 2022</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<!-- Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="css/animate.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.css" rel="stylesheet">
<!-- bootstrap select -->
<link href="css/bootstrap-select.min.css" rel="stylesheet">
<link href="css/checkboxes.css" rel="stylesheet">
<!-- recycling css from signup page because the layout is basically the same and I can't be bothered to make a new file just for this-->
<link href="css/pages/applyposition.css" rel="stylesheet">
<link href="css/index.css" rel="stylesheet">
<link href="color/default.css" rel="stylesheet">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-120398250-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-120398250-1');
</script>
</head>
<body id="page-top" data-spy="scroll" data-target=".navbar-custom">
<!-- PHP -->
<?php
session_start();
require_once('config.php');
if (isset($_POST["submit"])) {
$email = $_SESSION['id'];
// userid from `users`
$userid = mysqli_fetch_assoc(mysqli_query($link, "SELECT id FROM `users` WHERE email='$email'"))["id"];
// input variables
$birthdate = $_POST['birthdate'];
$nationality = $_POST['nationality'];
$diet = $_POST['diet']; //'n/a'; remove dietary requirement for online
$phone = str_replace(' ', '', mysqli_real_escape_string($link, $_POST['phonenum']));
$gender = $_POST['gender'];
$school = mysqli_real_escape_string($link, $_POST['school']);
$delegation = $_POST['delegation'];
$committee1 = $_POST['committee1'];
$country1 = $_POST[$committee1 . 'countries1'];
$committee2 = $_POST['committee2'];
$country2 = $_POST[$committee2 . 'countries2'];
$committee3 = $_POST['committee3'];
$country3 = $_POST[$committee3 . 'countries3'];
$experience = mysqli_real_escape_string($link, $_POST['experience']);
$motivation = mysqli_real_escape_string($link, $_POST['motivation']);
if (!$_POST['birthdate']) {
$errBirthdate = 'Please enter your birthdate';
}
if (!$_POST['nationality']) {
$errNationality = 'Please enter a valid nationality';
}
if (!$_POST['diet']) {
$errDiet = 'Please confirm your dietary preference';
}
if(!$_POST['gender']) {
$errGender = 'Please select a gender';
}
if(!$_POST['delegation']) {
$errDelegation = 'Please choose a delegation, or none if you are registering alone';
}
// school not necessary
if(!$_POST['committee1']) {
$errCommittee1 = 'Please select a committee';
}
if(!$_POST[$committee1 . 'countries1']) {
$errCountry1 = 'Please select a country';
}
if(!$_POST['committee2']) {
$errCommittee2 = 'Please select a committee';
}
if(!$_POST[$committee2 .'countries2']) {
$errCountry2 = 'Please select a country';
}
if(!$_POST['committee3']) {
$errCommittee3 = 'Please select a committee';
}
if(!$_POST[$committee3 . 'countries3']) {
$errCountry3 = 'Please select a country';
}
if(!$_POST['experience']) {
$errExperience = 'Please describe your experience';
}
if(!$_POST['motivation']) {
$errMotivation = 'Please describe your motivation';
}
if(!$_POST['agreetos']) {
$errAgreetos = 'Please read and agree to the Rules and Regulations';
}
// check if user is applying again
$checkPosition = mysqli_fetch_assoc(mysqli_query($link, "SELECT position FROM `users` WHERE email='$email'"))["position"];
if ($checkPosition != '' || $checkPosition == 'chair') {
$applyResult = '<div class="alert alert-danger">You have already applied for a position. If you believe this is an error, kindly contact us.</div>';
$errCheckPosition = 'You have already applied for a position. If you believe this is an error, kindly contact us.';
}
if(!$errBirthdate && !$errNationality && !$errDiet && !$errGender && !$errCommittee1 && !$errCountry1 && !$errCommittee2 && !$errCountry2 && !$errCommittee3 && !$errCountry3 && !$errExperience && !$errMotivation && !$errAgreetos && !$errCheckPosition) {
// delegation management
if ($delegation != '' && $delegation != 'none') {
mysqli_query($link, "UPDATE `delegations` SET delegates = delegates + 1 WHERE name = '$delegation';");
}
//convert birthdate to compatible format – doesn't work
// $birthdate_insert = date('Y-m-d', strtotime(str_replace('/', '-', $birthdate)));
// bad fix; string taken directly from input field
// in american format: mm/dd/yyyy
$birthdate_insert = $birthdate;
// db queries to insert data
$query1 = "UPDATE `users` SET phone = '$phone', birthdate = '$birthdate_insert', nationality = '$nationality', gender = '$gender', schoolname = '$school', position = 'delegate', dietary = '$diet' WHERE email = '$email';";
$result1 = mysqli_query($link, $query1);
$query2 = "INSERT INTO `delegates` (userid, delegation, choice1committee, choice1country, choice2committee, choice2country, choice3committee, choice3country, experience, motivationletter, email) VALUES ('$userid', '$delegation', '$committee1', '$country1', '$committee2', '$country2', '$committee3', '$country3', '$experience', '$motivation', '$email')";
$result2 = mysqli_query($link, $query2);
$_SESSION['position'] = 'delegate';
if ($result1 && $result2) {
$applyResult = '<div class="alert alert-success">Your delegation application has been successfully submitted. Expect a response to be delivered within 5-10 business days.</div>';
} else {
$signupresult = '<div class="alert alert-danger">Sorry, an error occurred while sumbitting your application. Please try again</div>';
}
}
}
?>
<!-- Preloader -->
<div id="preloader-overlay"></div>
<!-- navbar, inserted via js -->
<div id="header"></div>
<?php
if(isset($_SESSION['id']))
{
?>
<div class="apply parallax-window" data-parallax="scroll" data-image-src="img/school_img2.jpg">
<div class="apply-window">
<div class="container">
<h2>Apply as a Delegate</h2>
<div class="form-group">
<div class="col-md-4 col-md-offset-4">
<!-- <div class="alert alert-danger">Applications have been closed due to all delegate positions being filled. Further applications will be rejected. Sorry!</div> -->
<?php echo $applyResult ?>
</div>
</div>
<form id="applydelegate" class="form-horizontal" method="post" action="applydelegate">
<div class="form-group">
<div class="col-md-4 col-md-offset-4">
<?php echo $signupresult ?>
</div>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2 row">
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="firstname">First name: </label>
<div class="col-md-8">
<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name" value="<?php echo $_SESSION['firstname']; ?>">
<?php echo "<p class='text-danger'><b>$errFirstname</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="lastname">Last name: </label>
<div class="col-md-8">
<input type="text" class="form-control" id="lastname" name="lastname" placeholder="Last Name" value="<?php echo $_SESSION['lastname']; ?>">
<?php echo "<p class='text-danger'><b>$errLastname</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="email">Email: </label>
<div class="col-md-8">
<input type="text" class="form-control" id="email" name="email" placeholder="Email" value="<?php echo $_SESSION['id']; ?>">
<?php echo "<p class='text-danger'><b>$errEmail</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="phonenum">Phone number: </label>
<div class="col-md-8">
<input type="text" class="form-control" id="phonenum" name="phonenum" placeholder="Phone Number" value="<?php echo $phone; ?>">
<?php echo "<p class='text-danger'><b>$errPhonenum</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="firstname">Birth date: </label>
<div class="col-md-8">
<div class="input-group date" data-provide="datepicker">
<input type="text" class="form-control" name="birthdate" value="<?php echo $birthdate; ?>">
<div class="input-group-addon">
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
<?php echo "<p class='text-danger'><b>$errBirthdate</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="gender">Gender: </label>
<div class="col-md-8">
<select class="selectpicker" name="gender" title="Select a gender" value="<?php echo $gender; ?>">
<option value="male" <?php if ($_POST['gender'] == "male") echo 'selected'; ?>>Male</option>
<option value="female" <?php if ($_POST['gender'] == "female") echo 'selected'; ?>>Female</option>
<!-- <option value="other" <?php //if ($_POST['gender'] == "other") echo 'other'; ?>>other</option> -->
</select>
<?php echo "<p class='text-danger'><b>$errGender</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="nationality">Nationality: </label>
<div class="col-md-8">
<select class="selectpicker" data-live-search="true" name="nationality" title="Select a nationality" selected="<?php echo $nationality; ?>">
<option value="">-- select one --</option>
<option value="afghan">Afghan</option>
<option value="albanian">Albanian</option>
<option value="algerian">Algerian</option>
<option value="american">American</option>
<option value="andorran">Andorran</option>
<option value="angolan">Angolan</option>
<option value="antiguans">Antiguans</option>
<option value="argentinean">Argentinean</option>
<option value="armenian">Armenian</option>
<option value="australian">Australian</option>
<option value="austrian">Austrian</option>
<option value="azerbaijani">Azerbaijani</option>
<option value="bahamian">Bahamian</option>
<option value="bahraini">Bahraini</option>
<option value="bangladeshi">Bangladeshi</option>
<option value="barbadian">Barbadian</option>
<option value="barbudans">Barbudans</option>
<option value="batswana">Batswana</option>
<option value="belarusian">Belarusian</option>
<option value="belgian">Belgian</option>
<option value="belizean">Belizean</option>
<option value="beninese">Beninese</option>
<option value="bhutanese">Bhutanese</option>
<option value="bolivian">Bolivian</option>
<option value="bosnian">Bosnian</option>
<option value="brazilian">Brazilian</option>
<option value="british">British</option>
<option value="bruneian">Bruneian</option>
<option value="bulgarian">Bulgarian</option>
<option value="burkinabe">Burkinabe</option>
<option value="burmese">Burmese</option>
<option value="burundian">Burundian</option>
<option value="cambodian">Cambodian</option>
<option value="cameroonian">Cameroonian</option>
<option value="canadian">Canadian</option>
<option value="cape verdean">Cape Verdean</option>
<option value="central african">Central African</option>
<option value="chadian">Chadian</option>
<option value="chilean">Chilean</option>
<option value="chinese">Chinese</option>
<option value="colombian">Colombian</option>
<option value="comoran">Comoran</option>
<option value="congolese">Congolese</option>
<option value="costa rican">Costa Rican</option>
<option value="croatian">Croatian</option>
<option value="cuban">Cuban</option>
<option value="cypriot">Cypriot</option>
<option value="czech">Czech</option>
<option value="danish">Danish</option>
<option value="djibouti">Djibouti</option>
<option value="dominican">Dominican</option>
<option value="dutch">Dutch</option>
<option value="east timorese">East Timorese</option>
<option value="ecuadorean">Ecuadorean</option>
<option value="egyptian">Egyptian</option>
<option value="emirian">Emirian</option>
<option value="equatorial guinean">Equatorial Guinean</option>
<option value="eritrean">Eritrean</option>
<option value="estonian">Estonian</option>
<option value="ethiopian">Ethiopian</option>
<option value="fijian">Fijian</option>
<option value="filipino">Filipino</option>
<option value="finnish">Finnish</option>
<option value="french">French</option>
<option value="gabonese">Gabonese</option>
<option value="gambian">Gambian</option>
<option value="georgian">Georgian</option>
<option value="german">German</option>
<option value="ghanaian">Ghanaian</option>
<option value="greek">Greek</option>
<option value="grenadian">Grenadian</option>
<option value="guatemalan">Guatemalan</option>
<option value="guinea-bissauan">Guinea-Bissauan</option>
<option value="guinean">Guinean</option>
<option value="guyanese">Guyanese</option>
<option value="haitian">Haitian</option>
<option value="herzegovinian">Herzegovinian</option>
<option value="honduran">Honduran</option>
<option value="hungarian">Hungarian</option>
<option value="icelander">Icelander</option>
<option value="indian">Indian</option>
<option value="indonesian">Indonesian</option>
<option value="iranian">Iranian</option>
<option value="iraqi">Iraqi</option>
<option value="irish">Irish</option>
<option value="israeli">Israeli</option>
<option value="italian">Italian</option>
<option value="ivorian">Ivorian</option>
<option value="jamaican">Jamaican</option>
<option value="japanese">Japanese</option>
<option value="jordanian">Jordanian</option>
<option value="kazakhstani">Kazakhstani</option>
<option value="kenyan">Kenyan</option>
<option value="kittian and nevisian">Kittian and Nevisian</option>
<option value="kuwaiti">Kuwaiti</option>
<option value="kyrgyz">Kyrgyz</option>
<option value="laotian">Laotian</option>
<option value="latvian">Latvian</option>
<option value="lebanese">Lebanese</option>
<option value="liberian">Liberian</option>
<option value="libyan">Libyan</option>
<option value="liechtensteiner">Liechtensteiner</option>
<option value="lithuanian">Lithuanian</option>
<option value="luxembourger">Luxembourger</option>
<option value="macedonian">Macedonian</option>
<option value="malagasy">Malagasy</option>
<option value="malawian">Malawian</option>
<option value="malaysian">Malaysian</option>
<option value="maldivan">Maldivan</option>
<option value="malian">Malian</option>
<option value="maltese">Maltese</option>
<option value="marshallese">Marshallese</option>
<option value="mauritanian">Mauritanian</option>
<option value="mauritian">Mauritian</option>
<option value="mexican">Mexican</option>
<option value="micronesian">Micronesian</option>
<option value="moldovan">Moldovan</option>
<option value="monacan">Monacan</option>
<option value="mongolian">Mongolian</option>
<option value="moroccan">Moroccan</option>
<option value="mosotho">Mosotho</option>
<option value="motswana">Motswana</option>
<option value="mozambican">Mozambican</option>
<option value="namibian">Namibian</option>
<option value="nauruan">Nauruan</option>
<option value="nepalese">Nepalese</option>
<option value="new zealander">New Zealander</option>
<option value="ni-vanuatu">Ni-Vanuatu</option>
<option value="nicaraguan">Nicaraguan</option>
<option value="nigerien">Nigerien</option>
<option value="north korean">North Korean</option>
<option value="northern irish">Northern Irish</option>
<option value="norwegian">Norwegian</option>
<option value="omani">Omani</option>
<option value="pakistani">Pakistani</option>
<option value="palauan">Palauan</option>
<option value="palestinian">Palestinian</option>
<option value="panamanian">Panamanian</option>
<option value="papua new guinean">Papua New Guinean</option>
<option value="paraguayan">Paraguayan</option>
<option value="peruvian">Peruvian</option>
<option value="polish">Polish</option>
<option value="portuguese">Portuguese</option>
<option value="qatari">Qatari</option>
<option value="romanian">Romanian</option>
<option value="russian">Russian</option>
<option value="rwandan">Rwandan</option>
<option value="saint lucian">Saint Lucian</option>
<option value="salvadoran">Salvadoran</option>
<option value="samoan">Samoan</option>
<option value="san marinese">San Marinese</option>
<option value="sao tomean">Sao Tomean</option>
<option value="saudi">Saudi</option>
<option value="scottish">Scottish</option>
<option value="senegalese">Senegalese</option>
<option value="serbian">Serbian</option>
<option value="seychellois">Seychellois</option>
<option value="sierra leonean">Sierra Leonean</option>
<option value="singaporean">Singaporean</option>
<option value="slovakian">Slovakian</option>
<option value="slovenian">Slovenian</option>
<option value="solomon islander">Solomon Islander</option>
<option value="somali">Somali</option>
<option value="south african">South African</option>
<option value="south korean">South Korean</option>
<option value="spanish">Spanish</option>
<option value="sri lankan">Sri Lankan</option>
<option value="sudanese">Sudanese</option>
<option value="surinamer">Surinamer</option>
<option value="swazi">Swazi</option>
<option value="swedish">Swedish</option>
<option value="swiss">Swiss</option>
<option value="syrian">Syrian</option>
<option value="taiwanese">Taiwanese</option>
<option value="tajik">Tajik</option>
<option value="tanzanian">Tanzanian</option>
<option value="thai">Thai</option>
<option value="togolese">Togolese</option>
<option value="tongan">Tongan</option>
<option value="trinidadian or tobagonian">Trinidadian or Tobagonian</option>
<option value="tunisian">Tunisian</option>
<option value="turkish">Turkish</option>
<option value="tuvaluan">Tuvaluan</option>
<option value="ugandan">Ugandan</option>
<option value="ukrainian">Ukrainian</option>
<option value="uruguayan">Uruguayan</option>
<option value="uzbekistani">Uzbekistani</option>
<option value="venezuelan">Venezuelan</option>
<option value="vietnamese">Vietnamese</option>
<option value="welsh">Welsh</option>
<option value="yemenite">Yemenite</option>
<option value="zambian">Zambian</option>
<option value="zimbabwean">Zimbabwean</option>
</select>
<?php echo "<p class='text-danger'><b>$errNationality</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="school">School: </label>
<div class="col-md-8">
<input type="text" class="form-control" id="school" name="school" placeholder="School Name" value="<?php echo $school; ?>">
<?php echo "<p class='text-danger'><b>$errSchool</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="diet">Dietary requirements: </label>
<div class="col-md-8">
<select class="selectpicker" name="diet" title="Select one" value="<?php //echo $diet; ?>">
<option value="none" <?php //if ($_POST['diet'] == "none") echo 'selected'; ?>>None</option>
<option value="vegetarian" <?php //if ($_POST['diet'] == "vegetarian") echo 'selected'; ?>>Vegetarian</option>
<option value="vegan" <?php //if ($_POST['diet'] == "vegan") echo 'selected'; ?>>Vegan</option>
</select>
<?php echo "<p class='text-danger'><b>$errDiet</b></p>"; ?>
</div>
</div>
<div class="col-md-6 form-group row">
<label class="control-label col-sm-4" for="delegation" data-toggle="tooltip" title="If you are going as a school, you can select the delegation created by your club teacher, otherwise, select 'None'">Delegation <i class="fas fa-info-circle"></i>: </label>
<div class="col-md-8">
<select class="selectpicker" data-live-search="true" name="delegation" title="Select a delegation" value="<?php echo $delegation; ?>">
<option value="none" <?php if ($_POST['delegation'] == "none") echo 'selected'; ?>>None</option>
<?php
for ($x = 1; $x <= mysqli_num_rows(mysqli_query($link, 'SELECT * FROM `delegations`')); $x++) {
$y = $x - 1;
$tempdelegation = mysqli_fetch_assoc(mysqli_query($link, "SELECT name FROM `delegations` LIMIT 1 OFFSET $y"))["name"];
$option = "<option value='$tempdelegation'>$tempdelegation</option>";
echo $option;
}
?>
</select>
<?php echo "<p class='text-danger'><b>$errDelegation</b></p>"; ?>
</div>
</div>
</div>
</div>
<div class="col-lg-2 col-lg-offset-5">
<hr class="marginbot-50">
</div>
<br><br><br><br>
<!-- COMMITTEE SELECTION -->
<div class="row">
<?php
// three committee choices, each with their own drop down menu
// committees and respective countries retrieved from database
for ($x = 1; $x <= 3; $x++) {
?>
<div class="col-sm-4">
<div class="form-group row">
<label class="control-label col-sm-4" for="<?php echo "committee".strval($x); ?>">
Committee choice <?php echo $x; ?>:
</label>
<!-- COMMITTEE -->
<div class="col-md-8">
<select class="selectpicker" id="<?php echo "committee".strval($x); ?>" name="<?php echo "committee".strval($x); ?>" title="Select a committee">
<!-- <optgroup label="General Assemblies">
</optgroup> -->
<?php
$committees = mysqli_query($link, "SELECT * FROM committees");
while ($committee = mysqli_fetch_assoc($committees)) {
$abbvname = $committee["abbvname"];
$displayname = $committee["displayname"];
?>
<option value="<?php echo $abbvname; ?>" <?php if ($_POST["committee".strval($x)] == $abbvname) echo 'selected'; ?>>
<?php
echo $displayname;
if ($abbvname != "legal" && $abbvname != "unwomen" && $abbvname != "paris" && $abbvname != "arab") {
echo " (" . strtoupper($abbvname) . ")";
}
?>
</option>
<?php
}
?>
</select>
<?php
if ($x == 1) {echo "<p class='text-danger'><b>$errCommittee1</b></p>";}
elseif ($x == 2) {echo "<p class='text-danger'><b>$errCommittee2</b></p>";}
elseif ($x == 3) {echo "<p class='text-danger'><b>$errCommittee3</b></p>";}
?>
</div>
<label class="control-label col-sm-4" for="1"></label>
<!-- COUNTRY PICKER FOR INDIVIDUAL COUNTRIES -->
<div class="col-md-8">
<?php
$abbvcommittees = mysqli_query($link, "SELECT abbvname FROM committees");
while ($abbvcommittee = mysqli_fetch_assoc($abbvcommittees)) {
$abbvname = $abbvcommittee["abbvname"];
$pickername = $abbvname.'countries'.strval($x);
?>
<div id="<?php echo $pickername; ?>" class="<?php echo 'countries'.strval($x); ?>" style="display:none">
<select class="selectpicker" name="<?php echo $pickername; ?>" title="Select a country" data-live-search="true">
<optgroup label="<?php echo strtoupper($abbvname); ?> Countries" style="color: black">
<?php
$country_data = mysqli_query($link, "SELECT countrycode, displayname2, userid FROM ".$abbvname);
while ($country = mysqli_fetch_assoc($country_data)) {
if ($country['userid'] == 0) {
echo '<option value='.$country['countrycode'].'>'.$country['displayname2'].'</option>';
} else {
echo '<option value='.$country['countrycode'].' disabled>'.$country['displayname2'].'</option>';
}
}
?>
</optgroup>
</select>
</div>
<?php
}
?>
<?php echo "<p class='text-danger'><b>$errCountry1</b></p>"; ?>
</div>
</div>
</div>
<?php
}
?>
</div>
<div class="col-lg-2 col-lg-offset-5">
<hr class="marginbot-50">
</div>
<br><br><br><br>
<div class="row">
<div class="col-sm-10 col-sm-offset-1 row">
<label class="control-label col-sm-3" for="experience">Describe your experience with MUNs: (~100 words)</label>
<div class="col-sm-9">
<textarea type="text" class="form-control" id="experience" name="experience" rows="5"><?php echo $experience; ?></textarea>
<?php echo "<p class='text-danger'>$errExperience</p>";?>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-10 col-sm-offset-1 row">
<label class="control-label col-sm-3" for="motivation">Why do you want to participate as a delegate at PLISMUN22? (~100 words)</label>
<div class="col-sm-9">
<textarea type="text" class="form-control" id="motivation" name="motivation" rows="5"><?php echo $motivation; ?></textarea>
<?php echo "<p class='text-danger'>$errMotivation</p>";?>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4 col-sm-offset-2">
<div class="funkyradio">
<div class="funkyradio-success">
<input type="checkbox" name="agreetos" id="agreetos">
<label for="agreetos">I have read and agree to the <a href="tos">Terms and Conditions</a></label>
<?php echo "<p class='text-danger'>$errAgreetos</p>";?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4 col-sm-offset-2">
<input id="submit" name="submit" type="submit" class="btn btn-success btn-send col-md-3" value="Submit">
</div>
</div>
</form>
</div>
</div>
</div>
<?php } else { ?>
<h1 style="text-align: center; margin-top: 10%;">Please login or signup to access this page</h1>
<?php } ?>
<!-- footer-->
<div id="footer"></div>
<!-- /footer -->
<!-- Core JavaScript Files -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.scrollTo.js"></script>
<!--reveal while scrolling script-->
<script src="js/wow.min.js"></script>
<!-- Custom Theme JavaScript -->
<script src="js/custom.js"></script>
<!-- parallax script -->
<script src="js/parallax.min.js"></script>
<!-- bootstrap select js -->
<script src="js/bootstrap-select.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.min.js"></script>
<script type="text/javascript">
// include footer
$(function() {
$("#header").load("navbar");
$("#footer").load("footer");
$("#preloader-overlay").load("preloader");
});
$('.datepicker').datepicker();
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
$(function() {
$('#committee1').change(function(){
$('.countries1').hide();
$('#' + $(this).val() + 'countries1').show();
});
});
$(function() {
$('#committee2').change(function(){
$('.countries2').hide();
$('#' + $(this).val() + 'countries2').show();
});
});
$(function() {
$('#committee3').change(function(){
$('.countries3').hide();
$('#' + $(this).val() + 'countries3').show();
});
});
</script>
</body>
</html>