Form zonder submit button.
Groeten ZaP
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<form action="#" method="post" name="jenaam">
<select name="iets" onchange="document.forms.jenaam.submit();">
<option value="lala">La de la!</option>
<option value="laasddsagla">algasddsaal</option>
<option value="sjap">pajs</option>
<option value="kaas">saak</option>
<option value="tomaat">taamot</option>
<option value="wortel">letrow</option>
<option value="pipmel">lempip</option>
</select>
</form>
<pre>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
print_r($_POST);
}
?>
</pre>
<select name="iets" onchange="document.forms.jenaam.submit();">
<option value="lala">La de la!</option>
<option value="laasddsagla">algasddsaal</option>
<option value="sjap">pajs</option>
<option value="kaas">saak</option>
<option value="tomaat">taamot</option>
<option value="wortel">letrow</option>
<option value="pipmel">lempip</option>
</select>
</form>
<pre>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
print_r($_POST);
}
?>
</pre>
Ik kom er nog niet uit, ik heb het trouwens wel een while staan, hier mijn 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
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
<?php
ob_start();
$select = "SELECT * FROM ".$tb_todo." ORDER by id DESC LIMIT $begin,$eind";
$query = mysql_query($select);
while ($rij = mysql_fetch_assoc($query)){
if($rij["status"] != ""){
switch($rij["status"]) {
case "1": $img = "green"; break;
case "2": $img = "blue"; break;
case "3": $img = "red"; break;
} } else { $img = "blue"; }
$sString = $rij["titel"] ;
$out = wordwrap($sString, 14, "\n", 1);
echo' <tr>
<td><font size="2" face="verdana">
';
?><a href="" onMouseover="showfloatie('<? echo $rij["content"] ;?>', event)" onMouseout="hidefloatie()">
<? echo "$out\n";?></a>
<? echo '
</font></td>
<td><font size="2" face="verdana">
<img src="star_full.gif" width="20" height="20">
<img src="star_full.gif" width="20" height="20">
<img src="star_full.gif" width="20" height="20">
<img src="star_full.gif" width="20" height="20">
<img src="star_full.gif" width="20" height="20">
</font></td>
<td><font size="2" face="verdana">'.$rij["naam"].'</font></td>
<td><font size="2" face="verdana">
<form action="index.php?p=todo" method="post" name="jenaam">
<select name="status" onchange="document.forms.jenaam.submit();">
<option>Wijzig Status</option>
<option>Onvoltooid (blauw)</option>
<option>Voltooid (groen)</option>
<option>Aflassen (rood)</option>
</select>
<input name="id" type="hidden" value="'.$rij["id"].'">
</form>
</font></td>
<td><font size="2" face="verdana"><img src="'.$img.'.gif" width="30" height="30"></font></td>
</tr> ';
}
?>
ob_start();
$select = "SELECT * FROM ".$tb_todo." ORDER by id DESC LIMIT $begin,$eind";
$query = mysql_query($select);
while ($rij = mysql_fetch_assoc($query)){
if($rij["status"] != ""){
switch($rij["status"]) {
case "1": $img = "green"; break;
case "2": $img = "blue"; break;
case "3": $img = "red"; break;
} } else { $img = "blue"; }
$sString = $rij["titel"] ;
$out = wordwrap($sString, 14, "\n", 1);
echo' <tr>
<td><font size="2" face="verdana">
';
?><a href="" onMouseover="showfloatie('<? echo $rij["content"] ;?>', event)" onMouseout="hidefloatie()">
<? echo "$out\n";?></a>
<? echo '
</font></td>
<td><font size="2" face="verdana">
<img src="star_full.gif" width="20" height="20">
<img src="star_full.gif" width="20" height="20">
<img src="star_full.gif" width="20" height="20">
<img src="star_full.gif" width="20" height="20">
<img src="star_full.gif" width="20" height="20">
</font></td>
<td><font size="2" face="verdana">'.$rij["naam"].'</font></td>
<td><font size="2" face="verdana">
<form action="index.php?p=todo" method="post" name="jenaam">
<select name="status" onchange="document.forms.jenaam.submit();">
<option>Wijzig Status</option>
<option>Onvoltooid (blauw)</option>
<option>Voltooid (groen)</option>
<option>Aflassen (rood)</option>
</select>
<input name="id" type="hidden" value="'.$rij["id"].'">
</form>
</font></td>
<td><font size="2" face="verdana"><img src="'.$img.'.gif" width="30" height="30"></font></td>
</tr> ';
}
?>
en hier de actie:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if (isset($_POST['submit'])) {
$status = beveilig($_POST['status']);
$id = beveilig($_POST['id']);
$query = "UPDATE ".$tb_todo." SET
`status`='$status'WHERE id = '$id'";
$results = mysql_query( $query );
if($results)
{ header("Location: index.php?p=todo");
}
else
{
die( "FOUT! !: " . mysql_error() );
}
$status = beveilig($_POST['status']);
$id = beveilig($_POST['id']);
$query = "UPDATE ".$tb_todo." SET
`status`='$status'WHERE id = '$id'";
$results = mysql_query( $query );
if($results)
{ header("Location: index.php?p=todo");
}
else
{
die( "FOUT! !: " . mysql_error() );
}
Alles staat trouwens op 1 pagina.
Maar als ik 1 van die dropdowns aan klik dan gebeurd er niks. ook neit een refresh dat hij de actie gaat voeren.
Wat doe ik fout?
Groeten ZaP