-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfighting.php
106 lines (98 loc) · 3.68 KB
/
fighting.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 ($fighting = $con->query($query)) {
while ($row = $fighting->fetch_assoc()) {
if($row['TYPE'] == 'fighting' && $row['POSITION'] == 1){
$fighting_art_num1 = $row["ID_ACTION"];
}
if($row['TYPE'] == 'fighting' && $row['POSITION'] == 2){
$fighting_art_num2 = $row["ID_ACTION"];
}
if($row['TYPE'] == 'fighting' && $row['POSITION'] == 3){
$fighting_art_num3 = $row["ID_ACTION"];
}
}
}
?>
<div class="form-group col-sm-4">
<br/>
<label >Fighting art: </label>
<select class="form-control update_fighting" id='fighting_art_1'>
<?php
$fighting_art = mysqli_query($con, "SELECT * FROM fighting_art ORDER BY ID ASC");
while ($row = $fighting_art->fetch_assoc()) {
if($row['ID'] == $fighting_art_num1){
echo '<option value="'.$row["ID"].'" selected>'.$row["Nom"].'</option>';
$fighting_description1 = $row["Rules"];
}else{
echo '<option value="'.$row["ID"].'">'.$row["Nom"].'</option>';
}
}
?>
</select>
<label for="fighting_art_1">#1</label>
<div id="update_fighting_art_1">
<textarea class="form-control" id="textarea_fighting_art_1" rows="3"><?php echo (isset($fighting_description1) ? $fighting_description1 : ''); ?></textarea>
</div>
</div>
<div class="form-group col-sm-4">
<br/>
<label >Fighting art: </label>
<select class="form-control update_fighting " id='fighting_art_2'>
<?php
$fighting_art = mysqli_query($con, "SELECT * FROM fighting_art ORDER BY ID ASC");
while ($row = $fighting_art->fetch_assoc()) {
if($row['ID'] == $fighting_art_num2){
echo '<option value="'.$row["ID"].'" selected>'.$row["Nom"].'</option>';
$fighting_description2 = $row["Rules"];
}else{
echo '<option value="'.$row["ID"].'">'.$row["Nom"].'</option>';
}
}
?>
</select>
<label for="fighting_art_1">#2</label>
<div id="update_fighting_art_2">
<textarea class="form-control" id="textarea_fighting_art_2" rows="3"><?php echo (isset($fighting_description2) ? $fighting_description2 : ''); ?></textarea>
</div>
</div>
<div class="form-group col-sm-4">
<br/>
<label >Fighting art: </label>
<select class="form-control update_fighting" id='fighting_art_3'>
<?php
$fighting_art = mysqli_query($con, "SELECT * FROM fighting_art ORDER BY ID ASC");
while ($row = $fighting_art->fetch_assoc()) {
if($row['ID'] == $fighting_art_num3){
echo '<option value="'.$row["ID"].'" selected>'.$row["Nom"].'</option>';
$fighting_description3 = $row["Rules"];
}else{
echo '<option value="'.$row["ID"].'">'.$row["Nom"].'</option>';
}
}
?>
</select>
<label for="fighting_art_1">#3</label>
<div id="update_fighting_art_3">
<textarea class="form-control" id="textarea_fighting_art_3" rows="3"><?php echo (isset($fighting_description3) ? $fighting_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;
$(section).html(data);
});
});
});
</script>