Problem filling an html form

Νικόλαος Κούρας nikos.kouras at gmail.com
Fri Jan 13 16:30:40 EST 2012


On 13 Ιαν, 23:13, MRAB <pyt... at mrabarnett.plus.com> wrote:
> On 13/01/2012 20:16, Νικόλαος Κούρας wrote:
>
>
>
>
>
>
>
>
>
> > On 13 Ιαν, 21:35, MRAB<pyt... at mrabarnett.plus.com>  wrote:
> >>  On 13/01/2012 17:02, Íéêüëáïò Êïýñáò wrote:
>
> >>  >  # 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 ("ÑùôÞóôå ìå ó÷åôéêÜ..."):
>
> >>  [snip]
>
> >>  Do you really want to look for the comment in that string instead of
> >>  looking for that string in the comment?
>
> > What do you mean?
>
> > I just want to check that the user hasnt pressed the submit button
> > leaving the default values with the input comment box.
>
> > Iam not sure what you mean.
>
> In the first part of the condition you're asking:
>
>      '@' in mail
>
> which is OK, but in the second part of the condition you're asking:
>
>      comment not in ("Ρωτήστε με σχετικά...")
>
> which I think should be:
>
>      "Ρωτήστε με σχετικά..." not in comment
>
> Incidentally, it looks to me like you're using Python 2, in which case
> it's probably a good idea to use Unicode, so that would be:
>
>      u"Ρωτήστε με σχετικά..." not in comment
>
> and so forth.

Ah yes i have had them reversed!

I corrected that now but still if the user submits the form by not
entering any input all the program does is reloads itself.

So the question now is why the program flow doesn't enter the if code
block since its conditions are met?

ps. http//superhost.gr/hosting.html is now http//superhost.gr/
directly.



More information about the Python-list mailing list