-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisorders.php
106 lines (99 loc) · 3.54 KB
/
disorders.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
<div class="panel-body">
<?php
$query = "SELECT * FROM fighting_disroder WHERE ID_SURVIVOR = $survivor_id";
if ($disorder = $con->query($query)) {
while ($row = $disorder->fetch_assoc()) {
if($row['TYPE'] == 'disorder' && $row['POSITION'] == 1){
$disorder_num1 = $row["ID_ACTION"];
}
if($row['TYPE'] == 'disorder' && $row['POSITION'] == 2){
$disorder_num2 = $row["ID_ACTION"];
}
if($row['TYPE'] == 'disorder' && $row['POSITION'] == 3){
$disorder_num3 = $row["ID_ACTION"];
}
}
}
?>
<div class="form-group col-sm-4">
<br/>
<label >Disorder: </label>
<select class="form-control update_fighting" id='disorder_1'>
<?php
$disorder_desc = mysqli_query($con, "SELECT * FROM disorder ORDER BY ID ASC");
while ($row = $disorder_desc->fetch_assoc()) {
if($row['ID'] == $disorder_num1){
echo '<option value="'.$row["ID"].'" selected>'.$row["Nom"].'</option>';
$disorder_description1 = $row["Rules"];
}else{
echo '<option value="'.$row["ID"].'">'.$row["Nom"].'</option>';
}
}
?>
</select>
<label for="disorder_1">#1</label>
<div id="update_disorder_1">
<textarea class="form-control" id="disorder_1" rows="3"><?php echo (isset($disorder_description1) ? $disorder_description1 : ''); ?></textarea>
</div>
</div>
<div class="form-group col-sm-4">
<br/>
<label >Disorder: </label>
<select class="form-control update_fighting" id='disorder_2'>
<?php
$disorder_desc = mysqli_query($con, "SELECT * FROM disorder ORDER BY ID ASC");
while ($row = $disorder_desc->fetch_assoc()) {
if($row['ID'] == $disorder_num2){
echo '<option value="'.$row["ID"].'" selected>'.$row["Nom"].'</option>';
$disorder_description2 = $row["Rules"];
}else{
echo '<option value="'.$row["ID"].'">'.$row["Nom"].'</option>';
}
}
?>
</select>
<label for="disorder_1">#2</label>
<div id="update_disorder_2">
<textarea class="form-control" id="disorder_2" rows="3"><?php echo (isset($disorder_description2) ? $disorder_description2 : ''); ?></textarea>
</div>
</div>
<div class="form-group col-sm-4">
<br/>
<label> Disorder: </label>
<select class="form-control update_fighting" id='disorder_3'>
<?php
$disorder_desc = mysqli_query($con, "SELECT * FROM disorder ORDER BY ID ASC");
while ($row = $disorder_desc->fetch_assoc()) {
if($row['ID'] == $disorder_num3){
echo '<option value="'.$row["ID"].'" selected>'.$row["Nom"].'</option>';
$disorder_description3 = $row["Rules"];
}else{
echo '<option value="'.$row["ID"].'">'.$row["Nom"].'</option>';
}
}
?>
</select>
<label for="disorder_3">#3</label>
<div id="update_disorder_3">
<textarea class="form-control" id="disorder_3" rows="3"><?php echo (isset($disorder_description3) ? $disorder_description3 : ''); ?></textarea>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('.update_fighting').off().on('change', function() {
var itemVal = $(this).val();
var character = <?php echo $survivor_id; ?>;
var itemID = $(this).attr('id');
$.ajax({
url: "update_fight.php",
type: 'POST',
data: { value: itemVal, id : character, type: itemID} ,
}).success(function(data){
var section = '#update_' + itemID;
console.log(section);
$(section).html(data);
});
});
});
</script>