Hallo,
Ik probeer mijn php script uit te voeren via jquery om vervolgens informatie van de bezoeker in te vullen in mijn mysql database. Dit om te voorkomen dat de gebruiker naar de php file wordt verwezen en er een witte pagina te zien is. Met alleen html en php werkt het heel goed. Alleen toen ik gebruik wilde maken van jquery ging het fout.
Ik krijg geen foutmeldingen maar mijn database wordt niet ingevuld.
PHP file
webpagina
Weet iemand wat hier fout gaat?
Alvast bedankt.
EDIT: kon de relevante tekst niet dik maken dus heb witte stukken toegevoegd.
Ik probeer mijn php script uit te voeren via jquery om vervolgens informatie van de bezoeker in te vullen in mijn mysql database. Dit om te voorkomen dat de gebruiker naar de php file wordt verwezen en er een witte pagina te zien is. Met alleen html en php werkt het heel goed. Alleen toen ik gebruik wilde maken van jquery ging het fout.
Ik krijg geen foutmeldingen maar mijn database wordt niet ingevuld.
PHP file
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| <? $name=$_POST['name']; $passwd=$_POST['email']; mysql_connect("127.0.0.1", "XXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXX") or die(mysql_error()); mysql_select_db("DUMEAS") or die(mysql_error()); mysql_query("INSERT INTO users(name,passwd) VALUES ('$name', '$passwd')") or die(mysql_error()); Print "Your information has been successfully added to the database."; ?> |
webpagina
HTML:
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="DUMEAS" content="DUMEAS (Dutch Messages Encryption and Solving)" /> <meta http-equiv="content-type" content="text/html;charset=iso-8859-2" /> <link rel="stylesheet" href="images/style.css" type="text/css" /> <title>DUMEAS</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" /> <script> $(function(){ $("input[type=submit], a, button").click(function(){ $.ajax({ url:'process.php', success:function(response){ alert(response); } }); // this will alert the code generated in example.php }); }) </script> </head> <body> <div class="content"> <div class="preheader"> <div class="padding"> <a href="#">About</a> <a href="#">Contact</a> </div> </div> <div class="header"> <div class="title"><big>DUMEAS</big><br /> </div> <div class="slogan">Dutch Messages Encryption and Solving<br /> </div> </div> <div id="nav"> <ul> <li><a href="http://www.free-css-templates.com">Home</a></li> </ul> <ul> <li><a href="http://www.free-css-templates.com">Exchange</a></li> </ul> <ul> <li><span style="font-weight: bold;">Services</span><br /> </li> </ul> <ul> <li><a href="http://www.free-css-templates.com">History</a></li> </ul> <ul> <li><a href="">Techniques</a></li> </ul> <ul> <li><a href="#">Forum</a></li> </ul> <ul> <li><a href="#">Archive</a></li> </ul> <ul> <li><a href="#">Contact</a></li> </ul> <ul> <li><a href="#">Links</a></li> </ul> </div> <div class="main_content"> <div class="sd_right"> <div class="text_padding"> <h2>Log in</h2> <br /> <br /> <h2>Search</h2> <form method="post" action="#"> <p><input name="search" class="search" type="text" /> <input value="Go" class="submit" type="submit" /> </p> </form> <br /> <h2>Dumeas News</h2> This is BinaryNews, a free, fully standards-compliant CSS template designed by <a href="http://www.free-css-templates.com/">Free CSS Templates</a>. This free template is released under a Creative Commons Attributions 2.5 license, so you're pretty much free to do whatever you want with it (even use it commercially) provided you keep the links in the footer intact. Aside from that, have fun with it :) <br /> <h2>Lastest Articles</h2> <a href="#">Link to a article</a><br /> <a href="#">Link to another article...</a><br /> <br /> <h2>Ranking <br /> </h2> <h2> <br /> </h2> <br /> </div> </div> <div class="sd_left"> <div class="text_padding"> <h2>About</h2> This is BinaryNews, a free, fully standards-compliant CSS template designed by <a href="http://www.free-css-templates.com/">Free CSS Templates</a>. This free template is released under a Creative Commons Attributions 2.5 license, so you're pretty much free to do whatever you want with it (even use it commercially) provided you keep the links in the footer intact. Aside from that, have fun with it :) <p class="date"><img src="images/comment.gif" alt="" /> <a class="date" href="#">Comments(2)</a> <img src="images/timeicon.gif" alt="" /> 21.02.</p> <br /> This is BinaryNews, a free, fully standards-compliant CSS template designed by <a href="http://www.free-css-templates.com/">Free CSS Templates</a>. This free template is released under a Creative Commons Attributions 2.5 license, so you're pretty much free to do whatever you want with it (even use it commercially) provided you keep the links in the footer intact. Aside from that, have fun with it :) <p class="date"><img src="images/comment.gif" alt="" /> <a class="date" href="#">Comments(15)</a> <img src="images/timeicon.gif" alt="" /> 13.01.</p> <form> Your Name: <input name="name" type="text" /><br /> E-mail: <input name="email" type="text" /> <br /> <input value="Submit" type="submit" /> </form> <br /> </div> </div> <div class="footer"> <div class="padding"> © 2007 <a href="#"><strong>SiteName.com</strong></a>. Designed by <a href="http://www.free-css-templates.com/">Free CSS Templates</a>, Thanks to <a href="http://www.openwebdesign.org/">Web Design</a> | <a href="rss/">RSS Feed</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> and <a href="http://validator.w3.org/check?uri=referer">XHTML</a> | <a href="#">Login</a> </div> </div> </div> </div> </body> </html> |
Weet iemand wat hier fout gaat?
Alvast bedankt.
EDIT: kon de relevante tekst niet dik maken dus heb witte stukken toegevoegd.