Problem filling an html form

Νικόλαος Κούρας nikos.kouras at
Fri Jan 13 12:02:17 EST 2012

# 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 ("Ρωτήστε με σχετικά..."):
			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>Ευχαριστώ για την ερώτηση! Θα σας
απαντήσω το συντομότερο δυνατό!" )
		print ( "<h2><font color=red>Συμπλήρωσε σωστά το mail σου και δώσε
το σχολιασμό σου!" )

In my webpage here 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?

More information about the Python-list mailing list