Probleem met gebruik van if
De titel zegt het al. Ik wil een if toepassen in het volgende gedeelte van een script. Deels werkt, want als $bodyguard op 1 staat dan geeft die mooi het invulveld weer waar je een bodyguard kan opgeven.
Als ik dat dan eenmaal doe en hij schrijft die naam naar de db, geeft die nog altijd het invulveld weer en echo'd die niet de waarde $bgspot1 ipv het invulveld.
Hopelijk kan iemand mij verder helpen.
Alvast bedankt!
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<? if ( $bodyguard == 0 ) { ?>
<tr>
<td><strong>You can not hire a bodyguard without a bodyguard spot!</strong></td>
</tr>
<? }else{
if ( $bodyguard == 1 ) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<? }else{
if (( $bodyguard == 1 ) and ( $bgspot1 != '' )) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><strong>You can not hire a bodyguard without a bodyguard spot!</strong></td>
</tr>
<? }else{
if ( $bodyguard == 1 ) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<? }else{
if (( $bodyguard == 1 ) and ( $bgspot1 != '' )) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
Ik snap de bedoeling niet helemaal. Hoe verander jij de waarde van $bodyguard?
Vrij lange lap code vandaar alleen dit gedeelte, rest werkt. Gaat puur om het toepassen van die if.
Gewijzigd op 01/01/1970 01:00:00 door Dennis
Dus: if ($bodyguard == "1") {
En het is het makkelijkst voor je om je html te echo'en, dan hoef je niet telkens php te openen/sluiten.
En wat bedoel je met $bgspot1 != '') ?? Maargoed, je krijgt dan iig iets zoals:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
if ($bodyguard == "0") {
echo '<tr>';
echo '<td><strong>You can not hire a bodyguard without a bodyguard spot!</strong></td>';
echo '</tr>';
} elseif ($bodyguard == "1") {
echo '<tr>';
echo '<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>';
echo '<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>';
echo '<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>';
echo '</tr>';
} elseif ($bodyguard == "1" && $bgspot1 != '') {
echo '<tr>';
echo '<td>'.$bgspot1.'</td>';
echo '<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>';
echo '<td></td>';
echo '</tr>';
}
?>
if ($bodyguard == "0") {
echo '<tr>';
echo '<td><strong>You can not hire a bodyguard without a bodyguard spot!</strong></td>';
echo '</tr>';
} elseif ($bodyguard == "1") {
echo '<tr>';
echo '<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>';
echo '<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>';
echo '<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>';
echo '</tr>';
} elseif ($bodyguard == "1" && $bgspot1 != '') {
echo '<tr>';
echo '<td>'.$bgspot1.'</td>';
echo '<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>';
echo '<td></td>';
echo '</tr>';
}
?>
Gewijzigd op 01/01/1970 01:00:00 door Steven Hack
Idd stom van de quotes, was ik vergeten. En alles echo'en mee eens, dat werk ik later even bij. Wil eerst zien of wat ik nu precies wil ook daadwerkelijk kan.
Voor alsnog ziet het er nu zo uit :
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
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
<? if ( $bodyguard == '0' ) { ?>
<tr>
<td><strong>You can not hire a bodyguard without a bodyguard spot!</strong></td>
</tr>
<? }elseif ( $bodyguard == '1' ) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '1' && $bgspot1 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<? }elseif ( $bodyguard == '2' ) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '2' && $bgspot1 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '2' && $bgspot1 != '' && $bgspot2 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<? }elseif ( $bodyguard == '3' ) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '3' && $bgspot1 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '3' && $bgspot1 != '' && $bgspot2 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '3' && $bgspot1 != '' && $bgspot2 != '' && $bgspot3 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot3; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<?
} // bg gedaan
?>
<tr>
<td><strong>You can not hire a bodyguard without a bodyguard spot!</strong></td>
</tr>
<? }elseif ( $bodyguard == '1' ) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '1' && $bgspot1 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<? }elseif ( $bodyguard == '2' ) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '2' && $bgspot1 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '2' && $bgspot1 != '' && $bgspot2 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<? }elseif ( $bodyguard == '3' ) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '3' && $bgspot1 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '3' && $bgspot1 != '' && $bgspot2 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }elseif ( $bodyguard == '3' && $bgspot1 != '' && $bgspot2 != '' && $bgspot3 != '' ) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot3; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<?
} // bg gedaan
?>
maar als ik jouw was zou ik functie's gaan gebruiken.
Aangezien je steeds de zelfde tabel commands gebruikt, en alleen de context veranderd, kun je dat het beste met een functie doen.
Bespaard je een hoop typwerk, en het ziet er overzichtelijker uit.
iets zoals:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
<?php
function get_table1($inhoud) {
$output = '<tr>';
$output .= '<td><input name="bodyguard'.$inhoud.'" type="text" class="entryfield" size="30" /></td>';
$output .= '<td><input type="submit" class="button" name="Invite'.$inhoud.'" value="Invite." /></td>';
$output .= '<td><input type="submit" class="button" name="Clear'.$inhoud.'" value="Clear." /></td>';
$output .= '</tr>';
return $output;
}
[/code]
Dat zou moeten werken, en dan kun je gewoon doen: get_table1(1);
voor bodygaurd 1, get_table1(2); voor bodyguard 2 etc.
function get_table1($inhoud) {
$output = '<tr>';
$output .= '<td><input name="bodyguard'.$inhoud.'" type="text" class="entryfield" size="30" /></td>';
$output .= '<td><input type="submit" class="button" name="Invite'.$inhoud.'" value="Invite." /></td>';
$output .= '<td><input type="submit" class="button" name="Clear'.$inhoud.'" value="Clear." /></td>';
$output .= '</tr>';
return $output;
}
[/code]
Dat zou moeten werken, en dan kun je gewoon doen: get_table1(1);
voor bodygaurd 1, get_table1(2); voor bodyguard 2 etc.
PHP Beginners handleiding doorlezen.
Cijfers (of ik denk in dit geval booleans) moeten niet tussen quotes, dan zou het namelijk een string zijn.
Waarschijnlijk is je oplossing de laatste else structuur weg te halen.
Jullie moeten allemaal (behalve Evert) gewoon Cijfers (of ik denk in dit geval booleans) moeten niet tussen quotes, dan zou het namelijk een string zijn.
Waarschijnlijk is je oplossing de laatste else structuur weg te halen.
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
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
<tr>
<td class="sub" colspan="3"><strong>Bodyguard Spots :</strong></td>
</tr>
<? if ( $bodyguard == '0' ) { ?>
<tr>
<td><strong>You can not hire a bodyguard without a bodyguard spot!</strong></td>
</tr>
<? }elseif ( $bodyguard == '1' && (empty($bgspot1) )) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<? } if ( $bodyguard == '1' && (!empty($bgspot1))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<? }elseif ( $bodyguard == '2' && (empty($bgspot1) && (empty($bgspot2) ))) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '2' && (!empty($bgspot1))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '2' && (!empty($bgspot1) && (!empty($bgspot2) ))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<? }elseif ( $bodyguard == '3' && (empty($bgspot1) && (empty($bgspot2) && (empty($bgspot3) )))) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '3' && (!empty($bgspot1) && (empty($bgspot2) && (empty($bgspot3) )))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '3' && (!empty($bgspot1) && (!empty($bgspot2) && (empty($bgspot3) )))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '3' && (!empty($bgspot1) && (!empty($bgspot1) && (!empty($bgspot1) )))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot3; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<?
} // bg klaar
?>
<td class="sub" colspan="3"><strong>Bodyguard Spots :</strong></td>
</tr>
<? if ( $bodyguard == '0' ) { ?>
<tr>
<td><strong>You can not hire a bodyguard without a bodyguard spot!</strong></td>
</tr>
<? }elseif ( $bodyguard == '1' && (empty($bgspot1) )) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<? } if ( $bodyguard == '1' && (!empty($bgspot1))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<? }elseif ( $bodyguard == '2' && (empty($bgspot1) && (empty($bgspot2) ))) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '2' && (!empty($bgspot1))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '2' && (!empty($bgspot1) && (!empty($bgspot2) ))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<? }elseif ( $bodyguard == '3' && (empty($bgspot1) && (empty($bgspot2) && (empty($bgspot3) )))) { ?>
<tr>
<td><input name="bodyguard1" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite1" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '3' && (!empty($bgspot1) && (empty($bgspot2) && (empty($bgspot3) )))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard2" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite2" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear2" value="Clear." /></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '3' && (!empty($bgspot1) && (!empty($bgspot2) && (empty($bgspot3) )))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><input name="bodyguard3" type="text" class="entryfield" size="30" /></td>
<td><input type="submit" class="button" name="Invite3" value="Invite." /></td>
<td><input type="submit" class="button" name="Clear3" value="Clear." /></td>
</tr>
<? }if ( $bodyguard == '3' && (!empty($bgspot1) && (!empty($bgspot1) && (!empty($bgspot1) )))) { ?>
<tr>
<td><? echo $bgspot1; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot2; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<tr>
<td><? echo $bgspot3; ?></td>
<td><input type="submit" class="button" name="Clear1" value="Clear." /></td>
<td></td>
</tr>
<?
} // bg klaar
?>
Iedereen bedankt voor zijn/haar reactie! :)
Karl schreef op 05.10.2008 15:43:
Cijfers (of ik denk in dit geval booleans) moeten niet tussen quotes, dan zou het namelijk een string zijn.