info ophalen uit een database en d.m.v. knop opslaan ?
Op het moment als ik op opslaan druk refreshed hij alleen maar de pagina en voert hij de veranderingen niet door,
Heeft iemand ideeen ?
Code (php)
1
2
3
4
5
2
3
4
5
<? if(isset($submit))
{
mysql_query("UPDATE 1_tekst SET id = '$_POST[id]' WHERE alinea = '$_POST[alinea]', b = '$_POST[b]', i = '$_POST[i]', u = '$_POST[u]', kop = '$_POST[kop]', url = '$_POST[url]' WHERE id = '$_POST[id]'");
}
?>
{
mysql_query("UPDATE 1_tekst SET id = '$_POST[id]' WHERE alinea = '$_POST[alinea]', b = '$_POST[b]', i = '$_POST[i]', u = '$_POST[u]', kop = '$_POST[kop]', url = '$_POST[url]' WHERE id = '$_POST[id]'");
}
?>
<HTML>
<BODY>
<TABLE>
<form name="bewerk" enctype="multipart/form-data" action="">
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
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
<?
include("dbdb.php");
$query = mysql_query("SELECT id,alinea,tekst,b,i,u,kop,url FROM 1_tekst ORDER BY '$a' ASC");
while($resultaat = mysql_fetch_array($query))
{
echo "<TR><TD rowspan=2>";
echo "<textarea name=\"tekst\" rows=\"4\" cols=\"50\">\"$resultaat[tekst]\"</textarea><br>";
echo "</TD><TD>";
echo "<p><input type=\"checkbox\" name=\"b\" value=\"1\" ";
if ($resultaat[b] == 1)
{
echo "CHECKED";
}
echo ">bold</p>";
echo "</TD><TD>";
echo "<p><input type=\"checkbox\" name=\"i\" value=\"1\" ";
if ($resultaat[i] == 1)
{
echo "CHECKED";
}
echo ">italic</p>";
echo "</TD><TD>";
echo "<p><input type=\"checkbox\" name=\"u\" value=\"1\" ";
if ($resultaat[u] == 1)
{
echo "CHECKED";
}
echo ">underline</p>";
echo "</TD></TR><TR><TD>";
echo "<p><input type=\"checkbox\" name=\"kop\" value=\"1\" ";
if ($resultaat[kop] == 1)
{
echo "CHECKED";
}
echo ">kop tekst</p>";
echo "</TD><TD>";
echo "<p><input type=\"checkbox\" name=\"url\" value=\"1\" ";
if ($resultaat[url] == 1)
{
echo "CHECKED";
}
echo ">hyperlink</p>";
echo "</TD></TR>";
}
echo "</TABLE>";
?>
include("dbdb.php");
$query = mysql_query("SELECT id,alinea,tekst,b,i,u,kop,url FROM 1_tekst ORDER BY '$a' ASC");
while($resultaat = mysql_fetch_array($query))
{
echo "<TR><TD rowspan=2>";
echo "<textarea name=\"tekst\" rows=\"4\" cols=\"50\">\"$resultaat[tekst]\"</textarea><br>";
echo "</TD><TD>";
echo "<p><input type=\"checkbox\" name=\"b\" value=\"1\" ";
if ($resultaat[b] == 1)
{
echo "CHECKED";
}
echo ">bold</p>";
echo "</TD><TD>";
echo "<p><input type=\"checkbox\" name=\"i\" value=\"1\" ";
if ($resultaat[i] == 1)
{
echo "CHECKED";
}
echo ">italic</p>";
echo "</TD><TD>";
echo "<p><input type=\"checkbox\" name=\"u\" value=\"1\" ";
if ($resultaat[u] == 1)
{
echo "CHECKED";
}
echo ">underline</p>";
echo "</TD></TR><TR><TD>";
echo "<p><input type=\"checkbox\" name=\"kop\" value=\"1\" ";
if ($resultaat[kop] == 1)
{
echo "CHECKED";
}
echo ">kop tekst</p>";
echo "</TD><TD>";
echo "<p><input type=\"checkbox\" name=\"url\" value=\"1\" ";
if ($resultaat[url] == 1)
{
echo "CHECKED";
}
echo ">hyperlink</p>";
echo "</TD></TR>";
}
echo "</TABLE>";
?>
<input type="hidden" name="id" value="">
</BODY>
</HTML>
Gebruik trouwens $_POST['opslaan'] ipv $opslaan, superglobals heten da :)