Salut tout le monde,
Pour un examen pratique je dois réaliser un site annuaire ou des clients peuvent s'inscrire et ensuite être trouvés par le biais d'un champs de recherche. Le site comporte donc une base de données.
Mon problème est que je n'arrive pas à mettre en place le formulaire avec l'enregistrement dans la base de données. Lorsque je vais sur le site la page d'enregistrement me donne l'erreur Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 31
Est-ce que quelqu'un pourrait m'aider ?
Voici le code du formulaire:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <meta name="generator" content="Adobe GoLive"> <title>Registration</title> <link href="style.css" rel="stylesheet" type="text/css" media="all"> <csscriptdict import> <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script> </csscriptdict> <csactiondict> <script type="text/javascript"><!-- var preloadFlag = false; function preloadImages() { if (document.images) { pre_img_Calque_1_down = newImage('images/registration_button.data_/img_Calque-1-down.gif'); preloadFlag = true; } } // --></script> </csactiondict> </head> <body onload="preloadImages();" bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0"> <div align="center"> <table width="265" border="0" cellspacing="0" cellpadding="0"> <tr height="37"> <td height="37"></td> </tr> <tr height="52"> <td height="52"><img src="images/title_registration.jpg" alt="" height="52" width="364" border="0"></td> </tr> </table> <form action="register.php" method="post" target="_self"> <table width="513" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <table border="0" cellspacing="0" cellpadding="0"> <tr height="42"> <td align="left" valign="middle" width="124" height="42"></td> <td align="left" valign="middle" width="30" height="42"></td> <td align="left" valign="middle" width="359" height="42"></td> </tr> <tr> <td align="left" valign="middle" width="124"> <div align="right"> <img src="images/labels/activities.gif" alt="" height="17" width="117" border="0"></div> </td> <td align="left" valign="middle" width="30"></td> <td align="left" valign="middle" width="359"> <div class="textfield"> <p><input class="textfield" type="text" name="activities" size="44"></p> </div> </td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr height="22"> <td width="113" height="22"></td> <td width="44" height="22"></td> <td width="276" height="22"></td> </tr> <tr> <td width="113"> <div align="right"> <img src="images/labels/society.gif" alt="" height="21" width="91" border="0"></div> </td> <td width="44"></td> <td class="textfield" width="276"><input class="textfield" type="text" name="society" size="43"></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr height="40"> <td width="108" height="40"></td> <td width="27" height="40"></td> <td width="276" height="40"></td> </tr> <tr> <td width="108"> <div align="right"> <img src="images/labels/address.gif" alt="" height="17" width="99" border="0"></div> </td> <td width="27"></td> <td class="textfield" width="276"><input class="textfield" type="text" name="adress1" size="44"></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr height="14"> <td width="108" height="14"></td> <td width="53" height="14"></td> <td width="276" height="14"></td> </tr> <tr> <td width="108"> <div align="right"></div> </td> <td width="53"></td> <td class="textfield" width="276"><input class="textfield" type="text" name="adress2" size="44"></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr height="36"> <td width="108" height="36"></td> <td width="27" height="36"></td> <td width="276" height="36"></td> </tr> <tr> <td width="108"> <div align="right"> <img src="images/labels/country.gif" alt="" height="20" width="95" border="0"></div> </td> <td width="27"></td> <td class="textfield" width="276"><input class="textfield" type="text" name="country" size="44"></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr height="40"> <td width="203" height="40"></td> <td width="20" height="40"></td> <td width="276" height="40"></td> </tr> <tr> <td width="203"> <div align="right"> <img src="images/labels/email.gif" alt="" height="18" width="176" border="0"></div> </td> <td width="20"></td> <td class="textfield" width="276"><input class="textfield" type="text" name="email" size="44"></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr height="47"> <td width="99" height="47"></td> <td width="27" height="47"></td> <td width="276" height="47"></td> </tr> <tr> <td width="99"> <div align="right"> <img src="images/labels/web.gif" alt="" height="17" width="49" border="0"></div> </td> <td width="27"></td> <td class="textfield" width="276"><input class="textfield" type="text" name="web" size="44"></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr height="50"> <td width="116" height="50"></td> <td width="17" height="50"></td> <td width="276" height="50"></td> </tr> <tr> <td width="116"> <div align="right"> <img src="images/labels/password.gif" alt="" height="21" width="118" border="0"></div> </td> <td width="17"></td> <td class="textfield" width="276"><input class="textfield" type="password" name="password" size="44"></td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr height="37"> <td width="312" height="37"></td> <td width="24" height="37"></td> <td width="158" height="37"></td> </tr> <tr> <td class="textfield" width="312"> <div align="right"> <input class="textfield" type="password" name="confirmation" size="44"></div> </td> <td width="24"></td> <td width="158"><img src="images/labels/confirmation.gif" alt="" height="18" width="158" border="0"></td> </tr> </table> <br> <br> <table width="512" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <div align="center"> <a onmousedown="changeImages('img_Calque_1','images/registration_button.data_/img_Calque-1-down.gif');return true" onmouseup="changeImages('img_Calque_1','images/registration_button.data_/img_Calque-1.gif');return true" onmouseout="changeImages('img_Calque_1','images/registration_button.data_/img_Calque-1.gif');return true"><input id="img_Calque_1" type="image" src="images/registration_button.data_/img_Calque-1.gif" alt="" name="img_Calque_1" height="66" width="162" border="0" livesrc="images/registration_button.psd"></a><input type="submit" name="submitButtonName"></div> </td> </tr> </table> </td> </tr> </table> </form> </div> </body> </html>
Et voici le code de la page register.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <meta name="generator" content="Adobe GoLive"> <title>Thank you for your registration</title> </head> <body bgcolor="#ffffff"> <?php if (empty($_post['activities']) || empty($_post['society']) || empty($_post['adress1']) || empty($_post['adresse2']) || empty($_post['country']) || empty($_post['email']) || empty($_post['web']) || empty($_post['password'])) die ("ERROR : Please, fill out every field."); if (preg_match("/^[\w\.-]+@[\w\.-]+\.[a-z]{2,3}$/", $_REQUEST ['email']) == false) die("ERREUR : adresse email non valide."); // connection base de donnée $liendb = mysql_connect ('localhost', 'wootchs', 'HamadA'); mysql_select_db ("members", $liendb); $sql = "INSERT INTO 'registred' ('activities', 'society', 'adress1', 'adress2', 'country', 'email', 'web', 'password', 'id') VALUES ($_POST['activities'], $_POST['society'], $_POST['adress1'], $_POST['adress2'], $_POST['country'], $_POST['email'], $_POST['web'], $_POST['password'], $_POST[''])"; // fin requete base de donnée if ($result = mysql_query($sql) !=false) print("user".$_REQUEST['name']." registred."); else print ("Error during registration."); mysql_close($liendb); ?> </body> </html>
Partager