Ik ben een newbie wat betreft php/mysql. Ik heb verschillende tutorials geprobeerd, maar ik krijg het niet voor elkaar om variabelen uit een formuliertje naar mn db te schrijven.
Ik krijg het idee dat er iets mis is in m'n configuratie. Ik kan namelijk handmatig gewoon wel data toevoegen aan mn tabellen.
Een simpel stukje code als:
Doet niet meer dan het leegkiepen van m'n formuliertje en schrijft dus geen data naar de tabel email_info...
Iemand een idee wat er fout gaat. (deze code komt btw van een php tutorial)
Ik krijg het idee dat er iets mis is in m'n configuratie. Ik kan namelijk handmatig gewoon wel data toevoegen aan mn tabellen.
Een simpel stukje code als:
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
| <?php if ($submit == "click"){ // The submit button was clicked! // Get the input for fullname and email then store it in the database. $connection = mysql_connect ("localhost", "root", ""); if ($connection == false){ echo mysql_errno().": ".mysql_error()."<BR>"; exit; } $query = "insert into email_info values ('$fullname', '$email')"; $result = mysql_db_query ("test", $query); if ($result){ echo "Success!"; } else{ echo mysql_errno().": ".mysql_error()."<BR>"; } mysql_close (); } else{ echo " <html><body> <form method=\"post\" action=\"insert.php3\"> Enter your full name <input type=\"text\" name=\"fullname\"></input><br> Enter your email address <input type=\"text\" name=\"email\"></input><br> <input type=\"submit\" name=\"submit\" value=\"click\"></input> </form> </body></html> "; } ?> |
Doet niet meer dan het leegkiepen van m'n formuliertje en schrijft dus geen data naar de tabel email_info...
Iemand een idee wat er fout gaat. (deze code komt btw van een php tutorial)
What the eyes see, and the ears hear, the mind believes...