Form wordt niet verwerkt
Staar me er nu al een tijdje blind op en heb flink lopen zoeken online maar kom er niet achter wat ik fout doe...
De PHP versie is 4 en die van MySql 4.1, dank alvast voor jullie hulp!
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
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
<?php
if($verwerkt) {
include ("connect.php");
$datum_nu = gmdate("Y.m.d H:i:s, \G\M\T", time() + 7200);
$insertSQL = "insert into gastenboek (datum, naam, tekst) Values ('$datum_nu', '$naam', '$tekst')";
echo $insertSQL;
$result = mysql_query($insertSQL) or die("Query failed");
}
?>
<HTML>
<head>
<style type="text/css">
<!--
TABLE {font-family:'Arial'; font-size:8pt; }
.lnk {font-family:'Arial'; font-size:8pt; }
//-->
</style>
</head>
<body>
<font face="Arial" size="2">
<form method='post' action='gastenboekd.php'>
<TABLE CELLSPACING="1" BORDER="0" WIDTH="100%">
<TR>
<TD WIDTH="20%">
<SELECT ALIGN="left" SIZE="1" NAME="naam">
<OPTION Value="0">Kies je naam...</OPTION>
<?php
include ("connect.php");
// Performing SQL query
$query_namen = "SELECT naam FROM `namen` WHERE invaller=0 ORDER BY `naam`";
$result = mysql_query($query_namen)
or die("Select query failed");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<option value=";
echo $line[naam];
echo ">$line[naam]</option>";
}
?>
<OPTION Value=Gastspreker>Gastspreker</OPTION>
</SELECT>
</TD>
<TD WIDTH="80%" VALIGN="TOP" Size="3" Align="center">
<textarea rows="3" cols="75" MAXLENGHT="290" NAME="tekst"><?php echo $tekst;?></textarea>
</TD>
</TR>
<TR>
<TD colspan=2 WIDTH="100%" VALIGN="TOP" Size="3" Align="left">
<input type="submit" name="verzenden" value="GO!">
<INPUT TYPE="HIDDEN" Name="verwerkt" VALUE=TRUE>
</TD>
</TR>
</table>
</Form>
<BR><BR>
<?php
// Performing SQL query
$query = "SELECT `gastenboek`.`datum`, `gastenboek`.`naam`, `gastenboek`.`tekst`
FROM `gastenboek` where datum > '2006-07-03 09:56:39'
ORDER BY `gastenboek`.`datum` DESC";
$result = mysql_query($query)
or die("Select query failed");
// Printing results in HTML
// Create a table.
print ("<TABLE BORDER=0>");
print ("<TR ALIGN=CENTER VALIGN=TOP>");
print ("<TD ALIGN=CENTER WIDTH='17%' VALIGN=TOP></TD>");
print ("<TD ALIGN=CENTER WIDTH='8%' VALIGN=TOP></B></TD>");
print ("<TD ALIGN=CENTER WIDTH='75%' VALIGN=TOP></TD>");
print ("</TR>");
// Fetch the results from the database.
print "\t<tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
//mysql_close ($Link);
print ("</TABLE>\n");
// Closing connection
mysql_close ($dbh);
?>
</body></html>
if($verwerkt) {
include ("connect.php");
$datum_nu = gmdate("Y.m.d H:i:s, \G\M\T", time() + 7200);
$insertSQL = "insert into gastenboek (datum, naam, tekst) Values ('$datum_nu', '$naam', '$tekst')";
echo $insertSQL;
$result = mysql_query($insertSQL) or die("Query failed");
}
?>
<HTML>
<head>
<style type="text/css">
<!--
TABLE {font-family:'Arial'; font-size:8pt; }
.lnk {font-family:'Arial'; font-size:8pt; }
//-->
</style>
</head>
<body>
<font face="Arial" size="2">
<form method='post' action='gastenboekd.php'>
<TABLE CELLSPACING="1" BORDER="0" WIDTH="100%">
<TR>
<TD WIDTH="20%">
<SELECT ALIGN="left" SIZE="1" NAME="naam">
<OPTION Value="0">Kies je naam...</OPTION>
<?php
include ("connect.php");
// Performing SQL query
$query_namen = "SELECT naam FROM `namen` WHERE invaller=0 ORDER BY `naam`";
$result = mysql_query($query_namen)
or die("Select query failed");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<option value=";
echo $line[naam];
echo ">$line[naam]</option>";
}
?>
<OPTION Value=Gastspreker>Gastspreker</OPTION>
</SELECT>
</TD>
<TD WIDTH="80%" VALIGN="TOP" Size="3" Align="center">
<textarea rows="3" cols="75" MAXLENGHT="290" NAME="tekst"><?php echo $tekst;?></textarea>
</TD>
</TR>
<TR>
<TD colspan=2 WIDTH="100%" VALIGN="TOP" Size="3" Align="left">
<input type="submit" name="verzenden" value="GO!">
<INPUT TYPE="HIDDEN" Name="verwerkt" VALUE=TRUE>
</TD>
</TR>
</table>
</Form>
<BR><BR>
<?php
// Performing SQL query
$query = "SELECT `gastenboek`.`datum`, `gastenboek`.`naam`, `gastenboek`.`tekst`
FROM `gastenboek` where datum > '2006-07-03 09:56:39'
ORDER BY `gastenboek`.`datum` DESC";
$result = mysql_query($query)
or die("Select query failed");
// Printing results in HTML
// Create a table.
print ("<TABLE BORDER=0>");
print ("<TR ALIGN=CENTER VALIGN=TOP>");
print ("<TD ALIGN=CENTER WIDTH='17%' VALIGN=TOP></TD>");
print ("<TD ALIGN=CENTER WIDTH='8%' VALIGN=TOP></B></TD>");
print ("<TD ALIGN=CENTER WIDTH='75%' VALIGN=TOP></TD>");
print ("</TR>");
// Fetch the results from the database.
print "\t<tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
//mysql_close ($Link);
print ("</TABLE>\n");
// Closing connection
mysql_close ($dbh);
?>
</body></html>
Gewijzigd op 01/01/1970 01:00:00 door CitynumbersDotcom