Bonjour voilà mon fichier inscription.html
Mon fichier inscription.py
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 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//FR" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Inscription</title> <meta name="GENERATOR" content="Quanta Plus"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form method="get" action="../cgi-bin/inscription.py"> <table> <tr> <td>Pseudo : </td> <td><input type="text" name="user_name"/></td> </tr> <tr> <td>Password : </td> <td><input type="password" name="user_password"/></td> </tr> <tr> <td>Type your password again : </td> <td><input type="password" name="user_password_bis"/></td> </tr> <tr> <td></td> <td><input type="submit" value="Submit"></td> </tr> </table> </form> </body> </html>
Tout se passe correctement mais il n'arrive pas à récuperer user_name et password_name, et je ne comprends pas pourquoi.
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 #! /usr/bin/python # -*- coding: utf-8 -*- import cgi form = cgi.FieldStorage() if form.has_key("user_name"): # La clé n'existera pas si le champ correspondant est resté vide text = form["user_name"].value else: text ="*** le champ phrase était vide ! ***" if form.has_key("user_password"): # La clé n'existera pas si le champ nomv = form["user_password"].value # correspondant est resté vide else: nomv ="mais vous ne m'avez pas indiqué votre nom" print "Content-Type: text/html\n" print """ <H3>Merci, %s !</H3> <H4>La phrase que vous m'avez fournie était : </H4> <H3><FONT Color="red"> %s </FONT></H3>""" % (nomv, text)
Merci de me répondre!
Partager