checkbox in php doet het niet

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Thomas

thomas

30/03/2007 10:16:00
Quote Anchor link
hallo ik heb een klein probleempje ik heb namelijk een checkbox om mijn auto's allemaal of 1 voor 1 te selecteren maar als ik hem selectreer en ik druk op verkoop dan doet ie het niet kan iemand mij hiermee helpen.
Dit is de code

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php /* ------------------------- */

//include("_include-jail.php");

include_once ("_include-config.php");
if(! check_login()) {
header("Location: login.php");
exit;
}

mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");



$dbres  = mysql_query("SELECT * FROM `[auto]` WHERE `id`='$id'");
$aantal = mysql_num_rows($dbres);

$dbres                = mysql_query("SELECT * FROM `[auto]` WHERE `owner`='{$data->login}'");
$id = mysql_num_rows($dbres);

/* ------------------------- */ ?>


<?PHP

  if($_COOKIE['layout'] == 'grijs')
  {

    include("grijs.php");
  }

  elseif($_COOKIE['layout'] == 'blauw')
  {

    include("blauw.php");
  }

  elseif($_COOKIE['layout'] == 'pimp')
  {

    include("pimpcss.php");
  }

  elseif($_COOKIE['layout'] == 'groen')
  {

    include("groen.php");
  }

  elseif($_COOKIE['layout'] == 'rood')
  {

    include("rood.php");
  }

    else {
    include("standart.php");
  }


?>

<html>
<script language="javascript">
var checked = 0;
function checkAll() {
  checked = !checked;
  for(i=0; i<document.form.elements.length; i++)
    document.form1.elements[i].checked = checked;
}
</script>
</head>
<table width=100%>
<tr>
<td class="subTitle">
<b>Garage</b>
</td>
</tr>
<?php

if($_POST['lekkerfikken'])
{

mysql_query("DELETE FROM `[auto]` WHERE `owner`='$data->login'");
mysql_query("UPDATE `[users]` SET `autos1` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos2` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos3` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos4` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos5` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos6` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos7` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos8` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos9` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos10` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos11` = '0' WHERE `login`='{$data->login}'");
echo '<tr><td class=maintxt>Je hebt al je auto(s) in de fik gestoken!<br>dat ruimt lekker op..</tr></td>';
exit;
}

if(isset($_POST['verkoopalles']))
{

    $waard = Array('','30000','50000','85000','90000','350000','199000','125000','135000','90000','265000','100000','');
    $garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `login`='$data->login' AND `id`='".$_GET['v']."'");
    $garage = mysql_query($garage1);
    $geld3 = $waard[$garage['soort']];

if($data->login == $garage['owner'])
{

    echo '<tr><td class="mainTxt" align="center"><font color=red><b>Je hebt al je autos verkocht</font></td></tr>
    <meta http-equiv=Refresh content=4;url=index.php?page=garage>'
;
    mysql_query("UPDATE `[users]` SET `cash`=`cash`+$geld3 WHERE `login`='$data->login'");
    mysql_query("DELETE FROM `[auto]` WHERE `owner`='$data->login'");
}
}


if ( isset ( $_GET['v'] ) && !empty ( $_GET['v'] ) )
{


$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `id`='".$_GET['v']."'");
$garage = mysql_fetch_assoc($garage1);

$waard =
Array('','30000','50000','85000','90000','350000','199000','125000','135000','90000','265000','100000','');
$geld1 = Array('','100','250','300','450','600','750','900','1050','1200','1350','');
$geld2 = $geld1[$garage['soort']];
$geld3 = $waard[$garage['soort']];
$geld = $geld3-$garage['schade']*$geld2;

if($geld < 1000)
{

$geld = 1000;
}



if($data->login == $garage['owner'])
{


echo '<tr><td class="mainTxt" align="center"><font color=red><b>Je hebt je wagen verkocht.</font></b></td></tr>
<meta http-equiv=Refresh content=4;url=index.php?page=garage>'
;
mysql_query("UPDATE `[users]` SET cash=(cash+".$geld.") WHERE `login`='".$data->login."'");
mysql_query("DELETE FROM `[auto]` WHERE `owner`='".$data->login."' AND
`id`='"
.$_GET['v']."'");

}
}


if ( isset ( $_POST['overheid'] ) && !empty ( $_POST['overheid'] ) )
{


$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `id`='".$_POST['id']."'");
$garage = mysql_fetch_assoc($garage1);

$waard =
Array('','30000','50000','85000','90000','350000','199000','125000','135000','90000','265000','100000','');  
$geld1 = Array('','100','250','300','450','600','750','900','1050','1200','1350','');
$geld2 = $geld1[$garage['soort']];
$geld3 = $waard[$garage['soort']];
$geld = $geld3-$garage['schade']*$geld2;
$id = $_POST['id'];
if($geld < 1000)
{

$geld = 1000;
}



if($data->login == $garage['owner'])
{


echo '<tr><td class="mainTxt" align="center"><font color=red><b>Je hebt je wagen verkocht.</font></b></td></tr>
<meta http-equiv=Refresh content=2;url=index.php?page=garage>'
;
mysql_query("UPDATE `[users]` SET cash=(cash+".$geld.") WHERE `login`='".$data->login."'");
mysql_query("DELETE FROM `[auto]` WHERE `owner`='".$data->login."' AND
`id`='"
.$_POST['id']."'");

}
}


if ( isset ( $_GET['r'] ) && !empty ( $_GET['r'] ) )
{


$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `id`='".$_GET['r']."' and
owner='"
.$data->login."'");

if($garage1 == 1)
{

// Your Car
}
else
{
// Not Your Car
}

$garage = mysql_fetch_assoc($garage1);
$geld1 = Array('','200','500','600','900','1200','1500','1800','2100','2400','1700','');
$geld2 = $geld1[$garage['soort']];
$geld = $garage['schade']*$geld2;

if($data->cash < $geld)
{

echo '<tr><td class="mainTxt" align="center">Je hebt niet genoeg geld op zak.</td></tr> ';
}

else
{
echo '<tr><td class="mainTxt" align="center">Je hebt je wagen gerepareerd.</td></tr> <meta
http-equiv=Refresh content=3;url=index.php?page=garage>'
;
mysql_query("UPDATE `[users]` SET `cash`=(cash-".$geld.") WHERE `login`='".$data->login."'");
mysql_query("UPDATE `[auto]` SET `schade`='0' WHERE `owner`='".$data->login."' AND
`id`='"
.$_GET['r']."'");
}
}


if ( isset ( $_POST['repareer'] ) && !empty ( $_POST['id'] ) )
{


$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `id`='".$_POST['id']."' and
owner='"
.$data->login."'");

if($garage1 == 1)
{

// Your Car
}
else
{
// Not Your Car
}

$garage = mysql_fetch_assoc($garage1);
$geld1 = Array('','200','500','600','900','1200','1500','1800','2100','2400','1700','');
$geld2 = $geld1[$garage['soort']];
$geld = $garage['schade']*$geld2;

if($data->cash < $geld)
{

echo '<tr><td class="mainTxt" align="center">Je hebt niet genoeg geld op zak.</td></tr> ';
}

else
{
echo '<tr><td class="mainTxt" align="center">Je hebt je wagen gerepareerd.</td></tr> <meta
http-equiv=Refresh content=3;url=index.php?page=garage>'
;
mysql_query("UPDATE `[users]` SET `cash`=(cash-".$geld.") WHERE `login`='".$data->login."'");
mysql_query("UPDATE `[auto]` SET `schade`='0' WHERE `owner`='".$data->login."' AND
`id`='"
.$_POST['id']."'");
}
}

if ( isset ( $_POST['crush'] ) )
{


$clan = mysql_query("SELECT * FROM `[clans]` WHERE `name`='".$data->clan."'");
$clan = mysql_fetch_object($clan);

if($clan->crusher > $clan->autos)
{

$crush1 = mysql_query("SELECT * FROM `[auto]` WHERE `owner`='".$data->login."' AND
`land`='"
.$data->land."'");
while($crush = mysql_fetch_object($crush1))
{

if($_POST[$crush->id] ==1)
{

$kogels +=12;
mysql_query("DELETE FROM `[auto]` WHERE `id`='".$crush->id."'");
}
}

$auto = $kogels/12;
mysql_query("UPDATE `[users]` SET `kogels`=(kogels+".$kogels.") WHERE
`login`='"
.$data->login."'");
mysql_query("UPDATE `[clans]` SET `auto`=(auto+".$auto.") WHERE `name`='".$data->clan."'");
echo '<tr><td class="mainTxt" align="center">Je hebt '.$auto.' autos omgezet naar '.$kogels.'
kogels.</td></tr>'
;
}

else
{
echo '<tr><td class="mainTxt" align="center">Je clan heeft geen crusher ingehuurd.</td></tr>';
}
}


$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `owner`='".$data->login."'");
$dbres  = mysql_query("SELECT * FROM `[auto]` WHERE `id`='$id'");
$aantal = mysql_num_rows($dbres);

if(mysql_num_rows($garage1) == 1)
{

// Your Car
}
else
{
// Not Your Car
}






print ' <tr><td><form method="post">';
print ' <table width="100%"><td class="Subtitle" align="center"
width=50><a href="index.php?page=garage&s=ID"><B><font color=black>#</font></B></td><td class="Subtitle" align="center"
width=50><a href="index.php?page=garage&s=#"><B><font color=black>Stad</font></B></td><td class="Subtitle" align="center" width=830><a href="index.php?page=garage&s=#"><b><font color=black>Soort</font></b></td>
<td class="subTitle" align="center" width=80><a href="index.php?page=garage&s=#"><b><font color=black>Snelheid</font></b></td>
<td class="Subtitle" align="center" width=60><a href="index.php?page=garage&s=#"><b><font color=black>Schade</font></b></td> <td class="Subtitle" align="center"
width=100><a href="index.php?page=garage&s=#"><b><font color=black>Waarde</font></b></td>'
;

while($garage = mysql_fetch_object($garage1))
{

$waard =
Array('','30000','50000','85000','90000','350000','199000','125000','135000','90000','265000','100000','');  
$geld1 = Array('','100','250','300','450','600','750','900','1050','1200','1350','');
$geld2 = $geld1[$garage->soort];
$geld3 = $waard[$garage->soort];
$geld = $geld3-$garage->schade*$geld2;
$land1         = Array('',"Amsterdam","Rotterdam","Den bosch","Utrecht","Hilversum","Den Haag","Zeeland","Assen","Almere","Tilburg","Hilversum Zuid","Duitsland","Italië","Japan","China","Portugal","Iraq","Zimbabwe","Rusland","Slowakije","Canada","Nieuw-Zeeland","Andorra","Zaire","Hawaii","Egypte","Oosterijk","Cuba","Zwitserland","Nepal","Zuid-Afrika","Tjechië","Wit-Rusland","Zweden","Mexico",Mongoli,"Thailand","Iran","Aruba","");
$land          = $land1[$garage->land];
$geld4 = Array('','200','500','600','900','1200','1500','1800','2100','2400','1700','');
$geld5 = $geld4[$garage->soort];
$geld6 = $garage->schade*$geld5;

if($_GET['s'] == "ID")
$dbres = mysql_query("SELECT `id`,`soort`,`schade`,`owner`,`land`,`tekoop` FROM `[auto]` WHERE `login`='{$data->login}' ORDER BY `id` ASC LIMIT $begin,30");

else
$dbres = mysql_query("SELECT `id`,`soort`,`schade`,`tekoop`,`snelheid` FROM `[auto]` WHERE `owner`='{$data->login}' ORDER BY `id` ASC LIMIT $begin,30");

$soort = Array('','Audi TT','Lexus SC430','BMW M3','Lotus M250','Koenigsegg CCR','Lamborghini Diablo','Aston Martin Vanquish','Mercedes CLK DTM','Bentley Continental','Bugatti Veyron','Tuned Honda CRX','Lamborgini','Ferrari Enzo','');
$soortauto = $soort[$garage->soort];
$snel = ("SELECT * FROM `[auto]` WHERE `snelheid`='{$data->login}'");
$snelheid = mysql_query($snel);
if($geld < 1000)
{

$geld = 1000;
}

echo ' <tr><td class="MainTxt" width=140> #'.$garage->id.' </td><td class="MainTxt" width=96> '.$land.'</td> <td class="mainTxt"
width=134>'
.$soortauto.'</td><td class="mainTxt" width=134>'.$garage->snelheid.'</td> <td class="MainTxt">'.$garage->schade.'%</td> <td
class="MainTxt">€'
.$geld.'<input type="hidden" name="'.$garage->id.'" value="'.$geld.'"></td><td class="mainTxt"><input type="checkbox" name="id[]"></td>';



}


?>
</body></html>
<?
if(isset($_POST['out'])) {
mysql_query("UPDATE `[auto]` SET `tekoop`='{$_POST['amount']}' WHERE
`owner`='{$data->login}' AND `id`='{$_POST['ID']}'"
);
print <<<ENDHTML
auto staat te koop.
<script language="javascript">
document.location = "markt.php";
</script>
ENDHTML
;
}

print <<<ENDHTML
</head>          
  <table width=100%>
    <tr><td class="mainTxt">
    <center>Er staan {$id} autos in deze garage!
    </center>
    </td></tr>
  </table>
</body>

<body style="; margin: 0px;">
<table width=100%>
<tr><td class="subTitle"><b>Zet Een Auto Te Koop</b></td></tr>


<tr><td class="mainTxt" align="center">
<form name="form" method="post"><table width=100%><p align=left>
Hier kan je je auto verkopen! Tik je ID in en wat je ervoor wilt hebben.<BR>
Je kan later de bod verhogen door je ID en je bedrag in te vullen.<BR>
Maar je kunt het natuurlijk ook lager zetten!</p>
<tr><td align="left">ID:</td><td align="left"><input type="text" maxlength=999999
name="ID" ></td></tr>
<tr><td align="left">Prijs:</td><td align="left"><input type="text"
maxlength=6 name="amount" ><br></td></tr>
<td></td><td align="left"><input type="submit" name="out" value="Toevoegen" style="width: 120;"></td>
</table></form>
</td></tr>
</table>
</body>
ENDHTML
;

if(isset($_POST['overheid'])) {
$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `id`='".$_GET['v']."'");
$garage  = mysql_fetch_assoc($garage1);
if($data->login == $garage['owner'])
{

mysql_query("UPDATE `[users]` SET cash=(cash+".$geld.") WHERE `login`='".$data->login."'");
mysql_query("DELETE FROM `[auto]` WHERE `owner`='".$data->login."' AND
`id`='"
.$_GET['v']."'");
mysql_query("UPDATE `[users]` SET `autos1` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos2` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos3` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos4` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos5` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos6` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos7` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos8` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos9` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos10` = '0' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `autos11` = '0' WHERE `login`='{$data->login}'");
    print <<<ENDHTML
  <table width=100%>
    <tr><td class="mainTxt">
    <center><b>U heeft de auto verkocht aan de overheid!</b>
    </center>
    </td></tr>
  </table>
ENDHTML
;
}


$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `owner`='".$data->login."'");

if(mysql_num_rows($garage1) == 1)
{

// Your Car
}
else
{
// Not Your Car
}
}

print <<<ENDHTML

ENDHTML
;

if(isset($_POST['Repareer'])) {
$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `id`='".$_GET['r']."'");
$garage  = mysql_fetch_assoc($garage1);
if($data->login == $garage['owner'])
{

mysql_query("UPDATE `[users]` SET cash=(cash-".$geld.") WHERE `login`='".$data->login."'");
mysql_query("DELETE FROM `[auto]` WHERE `owner`='".$data->login."' AND
`id`='"
.$_GET['r']."'");
    print <<<ENDHTML
  <table width=100%>
    <tr><td class="mainTxt">
    <center><b>U heeft de auto Gerepareert!</b>
    </center>
    </td></tr>
  </table>
ENDHTML
;
}


$garage1 = mysql_query("SELECT * FROM `[auto]` WHERE `owner`='".$data->login."'");

if(mysql_num_rows($garage1) == 1)
{

// Your Car
}
else
{
// Not Your Car
}
}

print <<<ENDHTML
<body style="; margin: 0px;">
<BR>
<table width=100%>
  <tr><td class="subTitle"><b>Auto Opties</b></td></tr>
  <tr><td class="mainTxt">
    <form method="post"><table width=100%>
<p align=left>Als je de auto verkoopt, verkoop je hem aan de eigenaar van de auto fabriek!</p><BR><BR>
<tr><td align="center"><BR><BR>
        <input type="submit" name="repareer"  value="Repareer" style="width: 130;"> &nbsp; <input type="submit" name="overheid"  value="Verkoop" style="width: 130;"></td>
    </table></form>
  </td></tr>
</table>
</body>
ENDHTML
;

echo "
<br />
<form method=post>
<tr><td class=Subtitle>Special</tr></td>
<tr><td class=Maintxt><p align=left>als je geen autos meer wilt hebben kun je ze allemaal in de fik steken!<br>je krijgt er alleen geen geld voor.</p>

<br><br><center><input type=submit name=lekkerfikken value='Steek maar in de fik'></center>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<center><input type=submit name=verkoopalles value='verkoop alles'></center></td></tr></form>
"
;


?>


Het gaat om regel nr.315/316 en de submit knop zit op regel nr.446 alvast bedankt
 
Er zijn nog geen reacties op dit bericht.



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.