Hi,
Ik heb een simpel gastenboek draaien op een website en ik maak gebruik van PHP en een MySQL database.
De volgende velden heb ik in de database:
rec_id
naam
email
website
location
comments
ip_address
datesubmitted
Probleem dat er optreed is als volgt.
Sinds dat we bij rec_id 100 zitten, krijg ik alleen maar lege records in mijn database te zien.
Wat je ook invult, hij maakt wel een record aan en noemt hem inmiddels 106 (aantal testjes) maar alle velden op de datum na zijn leeg.
Het gastenboek zelf laat uiteraar dus ook een lege entry zien.
Dit is het HTTP forumuliertje:
Dit is mijn addrecord.php pagina:
Waar kan het probleem liggen?
Ik heb een simpel gastenboek draaien op een website en ik maak gebruik van PHP en een MySQL database.
De volgende velden heb ik in de database:
rec_id
naam
website
location
comments
ip_address
datesubmitted
Probleem dat er optreed is als volgt.
Sinds dat we bij rec_id 100 zitten, krijg ik alleen maar lege records in mijn database te zien.
Wat je ook invult, hij maakt wel een record aan en noemt hem inmiddels 106 (aantal testjes) maar alle velden op de datum na zijn leeg.
Het gastenboek zelf laat uiteraar dus ook een lege entry zien.
Dit is het HTTP forumuliertje:
code:
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
| <form action="http://www.domeintjeenzo.nl/gastenboek/addrecord.php" method="post" name="gastenboek" onSubmit="return validate()">
<table width="410" border="0" align="center" cellpadding="0" cellspacing="5" class="content">
<tr>
<td scope="col"><div align="right">Naam</div></td>
<td scope="col">
<div align="left">
<label>
<input type="text" id="nme" name="name" maxlength="30" size="30" />
</label>
</div></td>
</tr>
<tr>
<td><div align="right">E-mail</div></td>
<td>
<div align="left">
<label>
<input type="text" id="eml" name="email" maxlength="200" size="30" />
</label>
</div></td>
</tr>
<tr class="content">
<td class="content"><div align="right">Website</div></td>
<td><div align="left">
<label>
<input type="text" id="site" name="website" maxlength="200" size="30" />
</label>
</div></td>
</tr>
<tr class="content">
<td class="content"><div align="right">Plaats</div></td>
<td><div align="left">
<label>
<input type="text" id="loc" name="location" maxlength="200" size="30" />
</label>
</div></td>
</tr>
<tr class="content">
<td valign="top" class="content"><div align="right">Bericht</div></td>
<td>
<div align="left">
<label>
<textarea id="comm" name="comments" cols="45" rows="10"></textarea>
</label>
</div></td>
</tr>
<tr class="content">
<td class="content"> </td>
<td><input type="submit" name="Submit" value="Plaats bericht" /></td>
</tr>
<tr class="content">
<td class="content"><div align="right"></div></td>
<td> <div align="left">
<label><span class="style1">* Naam & Bericht zijn verplicht
<br />
* Reclame is niet toegestaan ! </span></label></div></td>
</tr>
</table>
</form> |
Dit is mijn addrecord.php pagina:
code:
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
| <?php
//Setup the username, password and database name.
$dbaddress = "db.pcextreme.nl";
$user = "xxxxxxxxxxxxx";
$password = "xxxxxxxxxxx";
$db = "xxxxxxxxxxxx";
//Make a link to the database, then test the connection. If it cant link, due to bad username
//password, permissions, whatever, kill the process.
$link = mysql_connect($dbaddress, $user, $password);
if (!$link) die ("cant connect to mysql");
//select the database once connected.
mysql_select_db($db, $link) or die ("cannot connect");
//Fieldnames used
//rec_id
//name
//email
//website
//location
//comments
//ip_address
//datesubmitted
// Record the ip address because it gives us a weird, creepy, almost erotic sense of power
$ip_address = GetHostByName($REMOTE_ADDR);
//set up the query to insert the entry into the guestbook
$query = "INSERT INTO guestbook ( name, email, website, location, comments, ip_address, datesubmitted )
values ( '$name', '$email', '$website', '$location', '$comments', '$ip_address', NOW() )";
//run the query
mysql_query($query, $link) or die (mysql_error());
//close the sql connection.
mysql_close($link);
//Email the form
if ( count ( $HTTP_POST_VARS ) ) {
foreach ( $HTTP_POST_VARS as $key=>$value ) {
$msg.="$key: $value\n";
}
}
$msg.="\n\n\nIP Info: $REMOTE_ADDR - ".gethostbyaddr($REMOTE_ADDR)."\n";
// headers for the email listed below
$headers .= "From: $email\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$recipient="YOU@DOMAIN.COM";
$subject="New Entry Into The Guestbook";
mail($recipient, $subject, stripslashes($msg), $headers);
//Once the data is entered, redirect the user back to the guestbook
header("location: http://www.mijndomeintjeenzo.nl/index.php?pagina=gastenboek");
?> |
Waar kan het probleem liggen?
[ Voor 32% gewijzigd door ericafterdark op 19-12-2006 19:22 ]
Hier had uw reclame kunnen staan.