Í
Íéêüëáïò Êïýñáò
# get some enviromental values
form = cgi.FieldStorage()
mail = form.getvalue('mail') or ''
comment = form.getvalue('comment') or ''
# insert guest comments into database if form was submitted
if '@' in mail and comment not in ("ÑùôÞóôå ìå ó÷åôéêÜ..."):
try:
cursor.execute( '''INSERT INTO users(mail, comment) VALUES(%s,
%s)''', (mail, comment) )
except MySQLdb.Error, e:
print ( "Error %d: %s" % (e.args[0], e.args[1]) )
print ( "<h2><font color=blue>Åõ÷áñéóôþ ãéá ôçí åñþôçóç! Èá óáò
áðáíôÞóù ôï óõíôïìüôåñï äõíáôü!" )
sys.exit(0)
else:
print ( "<h2><font color=red>ÓõìðëÞñùóå óùóôÜ ôï mail óïõ êáé äþóå
ôï ó÷ïëéáóìü óïõ!" )
sys.exit(0)
==============================================
In my webpage here http://superhost.gr/hosting.html i ask the users
mail and comment in a html form.
No matter what info the user gives after he submits the form, nothing
else happens instead of reloading the page itself while what i want
the code to do is to enter the if structure and display the
appropriate message, depending if the user entered data in the imput
box or not.
Am i missing something here?
form = cgi.FieldStorage()
mail = form.getvalue('mail') or ''
comment = form.getvalue('comment') or ''
# insert guest comments into database if form was submitted
if '@' in mail and comment not in ("ÑùôÞóôå ìå ó÷åôéêÜ..."):
try:
cursor.execute( '''INSERT INTO users(mail, comment) VALUES(%s,
%s)''', (mail, comment) )
except MySQLdb.Error, e:
print ( "Error %d: %s" % (e.args[0], e.args[1]) )
print ( "<h2><font color=blue>Åõ÷áñéóôþ ãéá ôçí åñþôçóç! Èá óáò
áðáíôÞóù ôï óõíôïìüôåñï äõíáôü!" )
sys.exit(0)
else:
print ( "<h2><font color=red>ÓõìðëÞñùóå óùóôÜ ôï mail óïõ êáé äþóå
ôï ó÷ïëéáóìü óïõ!" )
sys.exit(0)
==============================================
In my webpage here http://superhost.gr/hosting.html i ask the users
mail and comment in a html form.
No matter what info the user gives after he submits the form, nothing
else happens instead of reloading the page itself while what i want
the code to do is to enter the if structure and display the
appropriate message, depending if the user entered data in the imput
box or not.
Am i missing something here?