Variable doorgeven.
ten eerste sorry voor de elle lange code.
Ik zit met het volgende probleem:
Ik zou graag de informatie die je bij regel 44 tot 100 moet invullen ( Dit zijn de leden uit dat team, daar staat een checkbox achter genaamd "playedinmatch' en daarachter staat "kills"
als je op de pagina komt zie je dus alle spelers in dat team. wat ik dan zou willen is dat wanneer je de speler het checkboxje hebt gegeven hij de kill en callsign op het stukje neer zet van regel: 203 tot 204 .
Ik ben er uren mee bezig geweest maar kom er niet uit.
Ik hoop dat iemand mij kan/wil helpen.
groet,
robin
EDIT: LEES 3DE REACTIE
Code (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
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
<?php
require_once("layout.php");
require_once("./config/config.php");
top();
$sql = "SELECT unitmembers.userid, unitmembers.unitid, units.name FROM unitmembers, units WHERE userid = " . $_SESSION['id'];
$res = mysql_query($sql) or trigger_error (mysql_error ());
$bestaat = mysql_num_rows($res);
if($bestaat == false){
echo"Error";
} else {
$info = mysql_fetch_array($res);
$_SESSION['name'] = $info['name'];
$_SESSION['wid'] = $info['unitid'];
}
if(isset($_POST['submit'] && $_POST['type'] == "Unit Battle")){
echo' <br><center>';
echo' <form method="post">';
echo' Select losing team:';
echo' <br><br>';
echo' <select name="lid" id="lid">';
//Get units from database
$sql = "SELECT id, name FROM units WHERE name <> '" . mysql_escape_string($_SESSION['name']) . "'";
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <option value="'.$list->id.'">'.$list->name.'</option>';
}
echo' </select>';
echo' <br><br>';
echo' <input name="submit2" type="submit" id="submit2" value="Next" />';
echo' </form></center>';
tablefooter();
}
//unit submit
elseif(isset($_POST['submit2'])){
tableheader("<font class='menutitle'>Enter Kills</font>");
echo' <br><center>';
echo' <form method="post">';
echo' Losers:<br><hr>';
echo' <table width="100%">
<tr>
<td width="33%"><div align="left">Player:</div></td>
<td width="33%"><div align="left">Played in match: </div></td>
<td width="33%"><div align="left">Kills:</div></td>
</tr>
</table>';
$sql= "SELECT users.id, users.callsign, unitmembers.userid, unitmembers.unitid FROM users, unitmembers WHERE users.id = unitmembers.userid AND unitmembers.unitid = " . $_POST['lid'];
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <table width="100%">
<tr>
<td width="33%"><div align="left">' . $list->callsign . '</div></td>
<td width="33%"><div align="left"><input name="playedinmatch" type="checkbox" id="playedinmatch" value="checkbox"></div></td>
<td width="33%"><div align="left"><input name="kills" type="text" id="kills" size="5" maxlength="2"></div></td>
</tr>
</table>';
}
echo' <br><br>';
echo' Winners:<br><hr>';
echo' <table width="100%">
<tr>
<td width="33%"><div align="left">Player:</div></td>
<td width="33%"><div align="left">Played in match: </div></td>
<td width="33%"><div align="left">Kills:</div></td>
</tr>
</table>';
$sql= "SELECT users.id, users.callsign, unitmembers.userid, unitmembers.unitid FROM users, unitmembers WHERE users.id = unitmembers.userid AND unitmembers.unitid = " . $_SESSION['wid'];
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <table width="100%">
<tr>
<td width="33%"><div align="left">' . $list->callsign . '</div></td>
<td width="33%"><div align="left"><input name="playedinmatch" type="checkbox" id="playedinmatch" value="checkbox"></div></td>
<td width="33%"><div align="left"><input name="kills" type="text" id="kills" size="5" maxlength="2"></div></td>
</tr>
</table>';
}
echo' <br><br>';
echo' <input name="submit5" type="submit" id="submit5" value="Next" />';
echo' </form></center>';
tablefooter();
}
//unit maps
elseif(isset($_POST['submit5'])){
tableheader("<font class='menutitle'>Enter Maps</font>");
echo' <br><center>';
echo' <form method="post">';
echo' Map #1:';
echo' <select name="map1" id="map1">';
//Get maps from database
$sql = "SELECT mapname FROM mapslist";
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <option value="'.$list->mapname.'">'.$list->mapname.'</option>';
}
echo' </select>';
echo' <br><br>';
echo' Map #2:';
echo' <select name="map2" id="map2">';
//Get maps from database
$sql = "SELECT mapname FROM mapslist";
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <option value="'.$list->mapname.'">'.$list->mapname.'</option>';
}
echo' </select>';
echo' <br><br>';
echo' Map #3:';
echo' <select name="map3" id="map3">';
//Get maps from database
$sql = "SELECT mapname FROM mapslist";
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <option value="'.$list->mapname.'">'.$list->mapname.'</option>';
}
echo' </select>';
echo' <br><br>';
echo' <input name="submit8" type="submit" id="submit8" value="Check Battle" />';
echo' </form></center>';
tablefooter();
}
//unit check
elseif(isset($_POST['submit8'])){
$reportdate = date("d-m-Y H:i");
tableheader("<font class='menutitle'>Check Battle</font>");
echo' <br><center>';
echo' <form method="post">';
echo' <div align="center"><br><hr></div>';
echo'
<table width="100%">
<tr>
<td width="100%" colspan="2"><div align="center">Battle Information<br><hr></div></td>
</tr>
<tr>
<td width="50%"><div align="center">Reported By: </div></td>
<td width="50%"><div align="center">' . $_SESSION['callsign'] . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Report Date: </div></td>
<td width="50%"><div align="center">' . $reportdate . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Winners: </div></td>
<td width="50%"><div align="center">' . $_SESSION['name'] . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Losers: </div></td>
<td width="50%"><div align="center"></div></td>
</tr>
</table>';
echo' <div align="center"><hr></div>';
echo'
<table width="100%">
<tr>
<td width="100%" colspan="2"><div align="center">Played Maps<br><hr></div></td>
</tr>
<tr>
<td width="50%"><div align="center">Map #1</div></td>
<td width="50%"><div align="center">' . $_POST['map1'] . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Map #2 </div></td>
<td width="50%"><div align="center">' . $_POST['map2'] . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Map #3 </div></td>
<td width="50%"><div align="center">' . $_POST['map3'] . '</div></td>
</tr>
</table>';
echo' <div align="center"><hr></div>';
echo' <div align="center">Players & Kills from winning team<br><hr></div>';
echo' <div align="center"><br><hr></div>';
echo' <div align="center">Players & Kills from losing team<br><hr></div>';
echo' <div align="center"><br><hr></div>';
echo' <input name="submit11" type="submit" id="submit11" value="Report Battle" />';
echo' </form></center>';
tablefooter();
}
//unit report
elseif(isset($_POST['submit11'])){
tableheader("<font class='menutitle'>Battle Reported!</font>");
echo' <br><center>';
echo' Battle Reported!';
echo' </center>';
tablefooter();
}
else{
tableheader("<font class='menutitle'>Select Battle Type</font>");
echo' <br><center>';
echo' <form method="post">';
echo' Select battle type:';
echo' <br><br>';
echo' <select name="type" id="type">';
echo' <option value="Single Battle">Single Battle</option>';
echo' <option value="Unit Battle">Unit Battle</option>';
echo' <option value="Allie Battle">Allie Battle</option>';
echo' </select>';
echo' <br><br>';
echo' <input name="submit" type="submit" id="submit" value="Next" />';
echo' </form></center>';
tablefooter();
}
bottum();
?>
require_once("layout.php");
require_once("./config/config.php");
top();
$sql = "SELECT unitmembers.userid, unitmembers.unitid, units.name FROM unitmembers, units WHERE userid = " . $_SESSION['id'];
$res = mysql_query($sql) or trigger_error (mysql_error ());
$bestaat = mysql_num_rows($res);
if($bestaat == false){
echo"Error";
} else {
$info = mysql_fetch_array($res);
$_SESSION['name'] = $info['name'];
$_SESSION['wid'] = $info['unitid'];
}
if(isset($_POST['submit'] && $_POST['type'] == "Unit Battle")){
echo' <br><center>';
echo' <form method="post">';
echo' Select losing team:';
echo' <br><br>';
echo' <select name="lid" id="lid">';
//Get units from database
$sql = "SELECT id, name FROM units WHERE name <> '" . mysql_escape_string($_SESSION['name']) . "'";
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <option value="'.$list->id.'">'.$list->name.'</option>';
}
echo' </select>';
echo' <br><br>';
echo' <input name="submit2" type="submit" id="submit2" value="Next" />';
echo' </form></center>';
tablefooter();
}
//unit submit
elseif(isset($_POST['submit2'])){
tableheader("<font class='menutitle'>Enter Kills</font>");
echo' <br><center>';
echo' <form method="post">';
echo' Losers:<br><hr>';
echo' <table width="100%">
<tr>
<td width="33%"><div align="left">Player:</div></td>
<td width="33%"><div align="left">Played in match: </div></td>
<td width="33%"><div align="left">Kills:</div></td>
</tr>
</table>';
$sql= "SELECT users.id, users.callsign, unitmembers.userid, unitmembers.unitid FROM users, unitmembers WHERE users.id = unitmembers.userid AND unitmembers.unitid = " . $_POST['lid'];
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <table width="100%">
<tr>
<td width="33%"><div align="left">' . $list->callsign . '</div></td>
<td width="33%"><div align="left"><input name="playedinmatch" type="checkbox" id="playedinmatch" value="checkbox"></div></td>
<td width="33%"><div align="left"><input name="kills" type="text" id="kills" size="5" maxlength="2"></div></td>
</tr>
</table>';
}
echo' <br><br>';
echo' Winners:<br><hr>';
echo' <table width="100%">
<tr>
<td width="33%"><div align="left">Player:</div></td>
<td width="33%"><div align="left">Played in match: </div></td>
<td width="33%"><div align="left">Kills:</div></td>
</tr>
</table>';
$sql= "SELECT users.id, users.callsign, unitmembers.userid, unitmembers.unitid FROM users, unitmembers WHERE users.id = unitmembers.userid AND unitmembers.unitid = " . $_SESSION['wid'];
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <table width="100%">
<tr>
<td width="33%"><div align="left">' . $list->callsign . '</div></td>
<td width="33%"><div align="left"><input name="playedinmatch" type="checkbox" id="playedinmatch" value="checkbox"></div></td>
<td width="33%"><div align="left"><input name="kills" type="text" id="kills" size="5" maxlength="2"></div></td>
</tr>
</table>';
}
echo' <br><br>';
echo' <input name="submit5" type="submit" id="submit5" value="Next" />';
echo' </form></center>';
tablefooter();
}
//unit maps
elseif(isset($_POST['submit5'])){
tableheader("<font class='menutitle'>Enter Maps</font>");
echo' <br><center>';
echo' <form method="post">';
echo' Map #1:';
echo' <select name="map1" id="map1">';
//Get maps from database
$sql = "SELECT mapname FROM mapslist";
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <option value="'.$list->mapname.'">'.$list->mapname.'</option>';
}
echo' </select>';
echo' <br><br>';
echo' Map #2:';
echo' <select name="map2" id="map2">';
//Get maps from database
$sql = "SELECT mapname FROM mapslist";
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <option value="'.$list->mapname.'">'.$list->mapname.'</option>';
}
echo' </select>';
echo' <br><br>';
echo' Map #3:';
echo' <select name="map3" id="map3">';
//Get maps from database
$sql = "SELECT mapname FROM mapslist";
$res = mysql_query($sql) or die (mysql_error());
while($list = mysql_fetch_object($res)) {
echo' <option value="'.$list->mapname.'">'.$list->mapname.'</option>';
}
echo' </select>';
echo' <br><br>';
echo' <input name="submit8" type="submit" id="submit8" value="Check Battle" />';
echo' </form></center>';
tablefooter();
}
//unit check
elseif(isset($_POST['submit8'])){
$reportdate = date("d-m-Y H:i");
tableheader("<font class='menutitle'>Check Battle</font>");
echo' <br><center>';
echo' <form method="post">';
echo' <div align="center"><br><hr></div>';
echo'
<table width="100%">
<tr>
<td width="100%" colspan="2"><div align="center">Battle Information<br><hr></div></td>
</tr>
<tr>
<td width="50%"><div align="center">Reported By: </div></td>
<td width="50%"><div align="center">' . $_SESSION['callsign'] . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Report Date: </div></td>
<td width="50%"><div align="center">' . $reportdate . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Winners: </div></td>
<td width="50%"><div align="center">' . $_SESSION['name'] . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Losers: </div></td>
<td width="50%"><div align="center"></div></td>
</tr>
</table>';
echo' <div align="center"><hr></div>';
echo'
<table width="100%">
<tr>
<td width="100%" colspan="2"><div align="center">Played Maps<br><hr></div></td>
</tr>
<tr>
<td width="50%"><div align="center">Map #1</div></td>
<td width="50%"><div align="center">' . $_POST['map1'] . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Map #2 </div></td>
<td width="50%"><div align="center">' . $_POST['map2'] . '</div></td>
</tr>
<tr>
<td width="50%"><div align="center">Map #3 </div></td>
<td width="50%"><div align="center">' . $_POST['map3'] . '</div></td>
</tr>
</table>';
echo' <div align="center"><hr></div>';
echo' <div align="center">Players & Kills from winning team<br><hr></div>';
echo' <div align="center"><br><hr></div>';
echo' <div align="center">Players & Kills from losing team<br><hr></div>';
echo' <div align="center"><br><hr></div>';
echo' <input name="submit11" type="submit" id="submit11" value="Report Battle" />';
echo' </form></center>';
tablefooter();
}
//unit report
elseif(isset($_POST['submit11'])){
tableheader("<font class='menutitle'>Battle Reported!</font>");
echo' <br><center>';
echo' Battle Reported!';
echo' </center>';
tablefooter();
}
else{
tableheader("<font class='menutitle'>Select Battle Type</font>");
echo' <br><center>';
echo' <form method="post">';
echo' Select battle type:';
echo' <br><br>';
echo' <select name="type" id="type">';
echo' <option value="Single Battle">Single Battle</option>';
echo' <option value="Unit Battle">Unit Battle</option>';
echo' <option value="Allie Battle">Allie Battle</option>';
echo' </select>';
echo' <br><br>';
echo' <input name="submit" type="submit" id="submit" value="Next" />';
echo' </form></center>';
tablefooter();
}
bottum();
?>
Gewijzigd op 01/01/1970 01:00:00 door Robin Peters
Sorry, maar ik kan er geen fatsoenlijk begrijpbare vraag uithalen. Je begint twee keer met een stuk van een vraag maar je maakt de vraag niet af.
Ik snap je vraag ook niet.. srry
Bij het stuk onder de comment //unit submit
Worden alle players weergegevens van het winnende en het verliezende team. Achter hun naam staan een checkbox deze staat voor : Gespeeld in wedstrijd.
Als jij een wedstrijd hebt gespeeld moet je dus aan vinken welke speler mee heeft gedaan door middel van die checkbox.
Achter die check box staat een textfield : Kills
Daar voer je het aantal kills dat die speler gemaakt heeft in.
Als deze informatie in is gevult ga je naar de volgende functie.(die werkt wel)
Dan kom je bij het stukje: //check match
Daar wil ik graag dat de informatie word weergegeven die je bij het stukje //unit submit hebt ingevult.
Ik hoop dat het nu wel begrijpbaar is :P anders hoor ik hetwel.
Gewijzigd op 01/01/1970 01:00:00 door Robin Peters
Sorry voor de bump, maar ik kom er niet uit.