Select probleem in IE 9
Rechts heb ik in een ander formulier een selectbox die bestaat uit DB waarden(venues) die ook met een while loop uit de database wordt gegenereerd.
De bedoeling is dat wanneer ik een radiobutton(event) klik, de bijbehorende waarde in de selectbox (venue) tevoorschijn komt.
Ik heb nu onderstaande code die perfect werkt in Firefox en Chrome.
Helaas werkt IE9 niet mee.
Als ik op de selectbox klik dan submit hij meteen terwijl in Firefox en Chrome de selectbox open blijft staan waarna ik gewoon de juiste waarde kan kiezen.
De fout lijkt ergens in onderstaand stukje code te zitten. Als ik deze code weghaal dan is het probleem ook weg.
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
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
<?php
if (!empty($_POST['radiobutton_value'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif (isset($_POST['new'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
elseif (isset($_POST['update'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif(isset($_POST['insert'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
else
{
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
?>
if (!empty($_POST['radiobutton_value'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif (isset($_POST['new'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
elseif (isset($_POST['update'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif(isset($_POST['insert'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
else
{
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
?>
Onderstaand een gedeelte van de overige code
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
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
<?php
require_once "/includes/deebee.php";
//***************************************************************************************
//SELECT
//***************************************************************************************
if (!isset($_POST['radiobutton_value']))
{
$_POST['radiobutton_value'] = "";
}
if (!isset($title))
{
$title = "";
}
if (!isset($description))
{
$description = "";
}
if (!isset($startdate))
{
$startdate = "";
}
if (!isset($starttime))
{
$starttime = "";
}
if (!isset($endtime) )
{
$endtime = "";
}
$query = "
SELECT *
FROM
event AS e
INNER JOIN
venue AS v
ON
v.venue_id = e.venue_id
ORDER BY
name
";
$result = mysql_query($query, $con);
$num_rows = mysql_num_rows($result);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div id="wrapper">
<div id="banner"></div>
<div id="nav">
<ul>
<li class="nav"><a href="index.php">Home</a></li>
<li class="nav"><a href="addvenue.php">Mijn locaties</a></li>
<li class="navactive"><a href="addevent.php">Mijn events</a></li>
<li class="nav"><a href="#">Contact</a></li>
</ul>
</div>
<div class="content">
<div class="left">
<div id="bluelistradio"><b>Komende events (<?php echo $num_rows ?>)</b></div>
<form method="post" name="my_events">
<?php
$prevvenue = "";
if($result === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
while( $row = mysql_fetch_assoc($result) ){
$venue = $row['venue_id'];
if ($venue != $prevvenue){
echo '<div id="listradio"> <b>' .$row['name']. '</b></div>';
}
if (($row['event_id'])== ($_POST['radiobutton_value'])){
$title = $row['title'];
$description = $row['description'];
echo '<label><div id="sublistradio"><input type="radio" checked="checked" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b></div><br />' ;
}
else{
echo '<label><div id="sublistradio"><input type="radio" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b></div><br />' ;
}
$prevvenue = $venue;
}
;
?>
</div>
</form>
<div class="right">
<div class="buttons">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="event_form">
<?php
if (!empty($_POST['radiobutton_value'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif (isset($_POST['new'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
elseif (isset($_POST['update'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif(isset($_POST['insert'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
else
{
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
?>
</div>
<table>
<tr>
<td valign="top">
<label class="formlabel">Naam locatie<?php if ( !isset($errors['venue_name'])) {
echo "<span class='formsmall'>";
}
else{
echo "<span class='formsmall_error'>";
}
?>
Koppel de locatie aan het event</span></label>
</td><td>
<select class="formselect" name="selectname">
<option value=""selected="selected">Mijn locaties</option>
<?php
$query = "
SELECT name
FROM venue
WHERE
venue_id =
(
SELECT venue_id
FROM
event
where event_id = '" .$_POST['radiobutton_value']. "')
";
$result2 = mysql_query($query, $con);
if($result2 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
$row2 = mysql_fetch_row($result2);
$selectedname =($row2[0]);
$query = "
SELECT name
FROM
venue
";
$result3 = mysql_query($query, $con);
if($result3 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
while( $row3 = mysql_fetch_assoc($result3) )
{
if (($row3['name'])== $selectedname){
echo '<option selected="selected" name=" ' .$selectedname . ' " value=" ' . $selectedname . '" >' . $selectedname . '</option>';
}
else{
echo '<option name=" ' .($row3['name']) . ' " value=" ' . ($row3['name']) . '" >' . ($row3['name']) . '</option>';
}}
?>
</select>
</td></tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
require_once "/includes/deebee.php";
//***************************************************************************************
//SELECT
//***************************************************************************************
if (!isset($_POST['radiobutton_value']))
{
$_POST['radiobutton_value'] = "";
}
if (!isset($title))
{
$title = "";
}
if (!isset($description))
{
$description = "";
}
if (!isset($startdate))
{
$startdate = "";
}
if (!isset($starttime))
{
$starttime = "";
}
if (!isset($endtime) )
{
$endtime = "";
}
$query = "
SELECT *
FROM
event AS e
INNER JOIN
venue AS v
ON
v.venue_id = e.venue_id
ORDER BY
name
";
$result = mysql_query($query, $con);
$num_rows = mysql_num_rows($result);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div id="wrapper">
<div id="banner"></div>
<div id="nav">
<ul>
<li class="nav"><a href="index.php">Home</a></li>
<li class="nav"><a href="addvenue.php">Mijn locaties</a></li>
<li class="navactive"><a href="addevent.php">Mijn events</a></li>
<li class="nav"><a href="#">Contact</a></li>
</ul>
</div>
<div class="content">
<div class="left">
<div id="bluelistradio"><b>Komende events (<?php echo $num_rows ?>)</b></div>
<form method="post" name="my_events">
<?php
$prevvenue = "";
if($result === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
while( $row = mysql_fetch_assoc($result) ){
$venue = $row['venue_id'];
if ($venue != $prevvenue){
echo '<div id="listradio"> <b>' .$row['name']. '</b></div>';
}
if (($row['event_id'])== ($_POST['radiobutton_value'])){
$title = $row['title'];
$description = $row['description'];
echo '<label><div id="sublistradio"><input type="radio" checked="checked" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b></div><br />' ;
}
else{
echo '<label><div id="sublistradio"><input type="radio" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b></div><br />' ;
}
$prevvenue = $venue;
}
;
?>
</div>
</form>
<div class="right">
<div class="buttons">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="event_form">
<?php
if (!empty($_POST['radiobutton_value'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif (isset($_POST['new'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
elseif (isset($_POST['update'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif(isset($_POST['insert'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
else
{
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
?>
</div>
<table>
<tr>
<td valign="top">
<label class="formlabel">Naam locatie<?php if ( !isset($errors['venue_name'])) {
echo "<span class='formsmall'>";
}
else{
echo "<span class='formsmall_error'>";
}
?>
Koppel de locatie aan het event</span></label>
</td><td>
<select class="formselect" name="selectname">
<option value=""selected="selected">Mijn locaties</option>
<?php
$query = "
SELECT name
FROM venue
WHERE
venue_id =
(
SELECT venue_id
FROM
event
where event_id = '" .$_POST['radiobutton_value']. "')
";
$result2 = mysql_query($query, $con);
if($result2 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
$row2 = mysql_fetch_row($result2);
$selectedname =($row2[0]);
$query = "
SELECT name
FROM
venue
";
$result3 = mysql_query($query, $con);
if($result3 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
while( $row3 = mysql_fetch_assoc($result3) )
{
if (($row3['name'])== $selectedname){
echo '<option selected="selected" name=" ' .$selectedname . ' " value=" ' . $selectedname . '" >' . $selectedname . '</option>';
}
else{
echo '<option name=" ' .($row3['name']) . ' " value=" ' . ($row3['name']) . '" >' . ($row3['name']) . '</option>';
}}
?>
</select>
</td></tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
Ziet iemand waar het fout gaat?
Gewijzigd op 26/08/2012 13:10:09 door N K
Code (php)
1
2
3
2
3
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="event_form">
//stuk met de php
</div>
//stuk met de php
</div>
Oftewel, je opent een form en sluit daarna een div. Hoe dan ook klopt dat niet. Ofwel je vergeet een form te sluiten, ofwel je vergeet een div te sluiten, ofwel die /div zou een /form moeten zijn.
Bij dit soort html fouten wordt het gedrag van browsers altijd onvoorspelbaar. Ze moeten dan namelijk zelf de html fouten aanpassen en dat doet elke browser anders.
Ik heb nu de form tag boven de openingsdiv gezet, helaas zonder succes. Maar ik denk wel dat ik het daar ergens moet zoeken.
Ik heb nu wel iets anders opmerkelijks gezien en dat is als ik helmaal naast de selectbox klik het form ook wordt gesubmit. Opmerkelijk..
Edit: Erwin, volgens mij heb ik je antwoord verkeerd opgevat. Kan je een form niet over meerdere divs heen zetten? bijv.
Gewijzigd op 26/08/2012 15:45:08 door N K
Nee, dit kan niet wat je nu hebt. Probeer het eens netjes uit te lijnen. Elke open tag een tabje inspringen, na een sluiten tag een tabje terug. Dat gaat bij jou niet werken. Zoals je het nu hebt moet je form sluiten tag direct na de form open tag komen, voor de div sluiten tag.
Ook wat divs weggehaald evenals tabellen etc.
Helaas blijft het probleem nog.
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
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
<?php
require_once "/includes/deebee.php";
//***************************************************************************************
//SELECT
//***************************************************************************************
if (!isset($_POST['radiobutton_value']))
{
$_POST['radiobutton_value'] = "";
}
if (!isset($title))
{
$title = "";
}
if (!isset($description))
{
$description = "";
}
if (!isset($startdate))
{
$startdate = "";
}
if (!isset($starttime))
{
$starttime = "";
}
if (!isset($endtime) )
{
$endtime = "";
}
$query = "
SELECT *
FROM
event AS e
INNER JOIN
venue AS v
ON
v.venue_id = e.venue_id
ORDER BY
name
";
$result = mysql_query($query, $con);
$num_rows = mysql_num_rows($result);
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="left">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="my_events">
<?php
$prevvenue = "";
if($result === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
while( $row = mysql_fetch_assoc($result) ){
$venue = $row['venue_id'];
if ($venue != $prevvenue){
echo '<b>' .$row['name']. '</b>';
}
if (($row['event_id'])== ($_POST['radiobutton_value'])){
$title = $row['title'];
$description = $row['description'];
echo '<label><input type="radio" checked="checked" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b><br />' ;
}
else{
echo '<label><input type="radio" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b><br />' ;
}
$prevvenue = $venue;
};?>
</form>
</div>
<div class="right">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="event_form">
<?php
if (!empty($_POST['radiobutton_value'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif (isset($_POST['new'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
elseif (isset($_POST['update'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif(isset($_POST['insert'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
else
{
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
?>
<select class="formselect" name="selectname">
<option value=""selected="selected">Mijn locaties</option>
<?php
$query2 = "
SELECT name
FROM venue
WHERE
venue_id =
(
SELECT venue_id
FROM
event
where event_id = '" .$_POST['radiobutton_value']. "')
";
$result2 = mysql_query($query2, $con);
if($result2 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query2.")");
}
else
$row2 = mysql_fetch_row($result2);
$selectedname =($row2[0]);
$query3 = "
SELECT name
FROM
venue
";
$result3 = mysql_query($query3, $con);
if($result3 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query3.")");
}
else
while( $row3 = mysql_fetch_assoc($result3) )
{
if (($row3['name'])== $selectedname){
echo '<option selected="selected" name=" ' .$selectedname . ' " value=" ' . $selectedname . '" >' . $selectedname . '</option>';
}
else{
echo '<option name=" ' .($row3['name']) . ' " value=" ' . ($row3['name']) . '" >' . ($row3['name']) . '</option>';
}}
?>
</select>
</form>
</div>
</body>
</html>
require_once "/includes/deebee.php";
//***************************************************************************************
//SELECT
//***************************************************************************************
if (!isset($_POST['radiobutton_value']))
{
$_POST['radiobutton_value'] = "";
}
if (!isset($title))
{
$title = "";
}
if (!isset($description))
{
$description = "";
}
if (!isset($startdate))
{
$startdate = "";
}
if (!isset($starttime))
{
$starttime = "";
}
if (!isset($endtime) )
{
$endtime = "";
}
$query = "
SELECT *
FROM
event AS e
INNER JOIN
venue AS v
ON
v.venue_id = e.venue_id
ORDER BY
name
";
$result = mysql_query($query, $con);
$num_rows = mysql_num_rows($result);
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="left">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="my_events">
<?php
$prevvenue = "";
if($result === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
while( $row = mysql_fetch_assoc($result) ){
$venue = $row['venue_id'];
if ($venue != $prevvenue){
echo '<b>' .$row['name']. '</b>';
}
if (($row['event_id'])== ($_POST['radiobutton_value'])){
$title = $row['title'];
$description = $row['description'];
echo '<label><input type="radio" checked="checked" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b><br />' ;
}
else{
echo '<label><input type="radio" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b><br />' ;
}
$prevvenue = $venue;
};?>
</form>
</div>
<div class="right">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="event_form">
<?php
if (!empty($_POST['radiobutton_value'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif (isset($_POST['new'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
elseif (isset($_POST['update'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif(isset($_POST['insert'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
else
{
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
?>
<select class="formselect" name="selectname">
<option value=""selected="selected">Mijn locaties</option>
<?php
$query2 = "
SELECT name
FROM venue
WHERE
venue_id =
(
SELECT venue_id
FROM
event
where event_id = '" .$_POST['radiobutton_value']. "')
";
$result2 = mysql_query($query2, $con);
if($result2 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query2.")");
}
else
$row2 = mysql_fetch_row($result2);
$selectedname =($row2[0]);
$query3 = "
SELECT name
FROM
venue
";
$result3 = mysql_query($query3, $con);
if($result3 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query3.")");
}
else
while( $row3 = mysql_fetch_assoc($result3) )
{
if (($row3['name'])== $selectedname){
echo '<option selected="selected" name=" ' .$selectedname . ' " value=" ' . $selectedname . '" >' . $selectedname . '</option>';
}
else{
echo '<option name=" ' .($row3['name']) . ' " value=" ' . ($row3['name']) . '" >' . ($row3['name']) . '</option>';
}}
?>
</select>
</form>
</div>
</body>
</html>
Toevoeging op 26/08/2012 16:45:33:
heee ik heb hem.
Ik heb een gedeelte van de code(knoppen "nieuw' " opslaan" etc) onder de select gezet en nu werkt alles wel. Waarom weet ik niet, misschien dat iemand het kan verklaren. Maar hoe kan ik nu deze knoppen boven de select positioneren?
Moet ik nu deze absoluut boven de select gaan positioneren met CSS? Of is er een andere oplossing.
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
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
<?php
require_once "/includes/deebee.php";
//***************************************************************************************
//SELECT
//***************************************************************************************
if (!isset($_POST['radiobutton_value']))
{
$_POST['radiobutton_value'] = "";
}
if (!isset($title))
{
$title = "";
}
if (!isset($description))
{
$description = "";
}
if (!isset($startdate))
{
$startdate = "";
}
if (!isset($starttime))
{
$starttime = "";
}
if (!isset($endtime) )
{
$endtime = "";
}
$query = "
SELECT *
FROM
event AS e
INNER JOIN
venue AS v
ON
v.venue_id = e.venue_id
ORDER BY
name
";
$result = mysql_query($query, $con);
$num_rows = mysql_num_rows($result);
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="left">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="my_events">
<?php
$prevvenue = "";
if($result === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
while( $row = mysql_fetch_assoc($result) ){
$venue = $row['venue_id'];
if ($venue != $prevvenue){
echo '<b>' .$row['name']. '</b>';
}
if (($row['event_id'])== ($_POST['radiobutton_value'])){
$title = $row['title'];
$description = $row['description'];
echo '<label><input type="radio" checked="checked" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b><br />' ;
}
else{
echo '<label><input type="radio" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b><br />' ;
}
$prevvenue = $venue;
};?>
</form>
</div>
<div class="right">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="event_form">
<select class="formselect" name="selectname">
<option value=""selected="selected">Mijn locaties</option>
<?php
$query2 = "
SELECT name
FROM venue
WHERE
venue_id =
(
SELECT venue_id
FROM
event
where event_id = '" .$_POST['radiobutton_value']. "')
";
$result2 = mysql_query($query2, $con);
if($result2 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query2.")");
}
else
$row2 = mysql_fetch_row($result2);
$selectedname =($row2[0]);
$query3 = "
SELECT name
FROM
venue
";
$result3 = mysql_query($query3, $con);
if($result3 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query3.")");
}
else
while( $row3 = mysql_fetch_assoc($result3) )
{
if (($row3['name'])== $selectedname){
echo '<option selected="selected" name=" ' .$selectedname . ' " value=" ' . $selectedname . '" >' . $selectedname . '</option>';
}
else{
echo '<option name=" ' .($row3['name']) . ' " value=" ' . ($row3['name']) . '" >' . ($row3['name']) . '</option>';
}}
?>
</select>
<?php
if (!empty($_POST['radiobutton_value'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif (isset($_POST['new'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
elseif (isset($_POST['update'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif(isset($_POST['insert'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
else
{
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
?>
</form>
</div>
</body>
</html>
require_once "/includes/deebee.php";
//***************************************************************************************
//SELECT
//***************************************************************************************
if (!isset($_POST['radiobutton_value']))
{
$_POST['radiobutton_value'] = "";
}
if (!isset($title))
{
$title = "";
}
if (!isset($description))
{
$description = "";
}
if (!isset($startdate))
{
$startdate = "";
}
if (!isset($starttime))
{
$starttime = "";
}
if (!isset($endtime) )
{
$endtime = "";
}
$query = "
SELECT *
FROM
event AS e
INNER JOIN
venue AS v
ON
v.venue_id = e.venue_id
ORDER BY
name
";
$result = mysql_query($query, $con);
$num_rows = mysql_num_rows($result);
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="left">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="my_events">
<?php
$prevvenue = "";
if($result === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query.")");
}
else
while( $row = mysql_fetch_assoc($result) ){
$venue = $row['venue_id'];
if ($venue != $prevvenue){
echo '<b>' .$row['name']. '</b>';
}
if (($row['event_id'])== ($_POST['radiobutton_value'])){
$title = $row['title'];
$description = $row['description'];
echo '<label><input type="radio" checked="checked" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b><br />' ;
}
else{
echo '<label><input type="radio" onClick="document.forms[\'my_events\'].submit()" name="radiobutton_value" value="' . $row['event_id'] . '"/>' . $row['startdate'] . ' <b>' . $row['title'] . '</b><br />' ;
}
$prevvenue = $venue;
};?>
</form>
</div>
<div class="right">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="event_form">
<select class="formselect" name="selectname">
<option value=""selected="selected">Mijn locaties</option>
<?php
$query2 = "
SELECT name
FROM venue
WHERE
venue_id =
(
SELECT venue_id
FROM
event
where event_id = '" .$_POST['radiobutton_value']. "')
";
$result2 = mysql_query($query2, $con);
if($result2 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query2.")");
}
else
$row2 = mysql_fetch_row($result2);
$selectedname =($row2[0]);
$query3 = "
SELECT name
FROM
venue
";
$result3 = mysql_query($query3, $con);
if($result3 === false)
{
echo("De volgende fout is opgetreden: ".mysql_error($con)." (".$query3.")");
}
else
while( $row3 = mysql_fetch_assoc($result3) )
{
if (($row3['name'])== $selectedname){
echo '<option selected="selected" name=" ' .$selectedname . ' " value=" ' . $selectedname . '" >' . $selectedname . '</option>';
}
else{
echo '<option name=" ' .($row3['name']) . ' " value=" ' . ($row3['name']) . '" >' . ($row3['name']) . '</option>';
}}
?>
</select>
<?php
if (!empty($_POST['radiobutton_value'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif (isset($_POST['new'])) {
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
elseif (isset($_POST['update'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
elseif(isset($_POST['insert'])){
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="update" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>
<input class="dbbutton" name="delete" type="submit" value="Verwijder" onclick="return confirm(\'Wilt u deze locatie verwijderen?\');"/>';
}
else
{
echo '<input class="dbbutton" name="new" type="submit" value="Nieuw" />
<input class="dbbutton" type="submit" name="insert" value="Opslaan" onclick="return confirm(\'Wilt u deze locatie opslaan?\');"/>';
}
?>
</form>
</div>
</body>
</html>
Dit leverde geen rare dingen op in Chrome en Firefox. In IE9 wel.