Separating design from code

Discussion in 'Python' started by Íéêüëáïò Êïýñáò, Mar 22, 2011.

  1. Hello, in this page http://www.superhost.gr/hosting.html at the bottom
    end i decided to create a textarea for the user to enter some comments
    related to the page that i want to submit to a mysql database table.

    Now i have seperated the design from the code:

    http://www.superhost.gr/hosting.html is the design
    http://www.superhost.gr/cgi-bin/counter.py is the python script

    Every request to any html page due to mod rewrite is passed to the
    above python script.

    Its my first time tryign to do this so i need to ask:

    a) When the user hits submit after entering comments in the
    hosting.html

    <form method="post" action="http://superhost.gr/cgi-bin/counter.py">
    <textarea name="comments" cols="40" rows="5">
    Ó÷ïëéÜóôå Þ ñùôÞóôå ìå ó÷åôéêÜ....
    </textarea><br>
    <input type="submit" value="ÑùôÞóôå" />
    </form>

    What should the action be? The file itself or to the python code
    script
    As i have it now i am getting an error
    Just try to enter something and hit sumbit you will see an error page.

    #relevant counter.py code
    # get some enviromental values
    form = cgi.FieldStorage()
    page = form.getvalue('page')

    # try to open the page
    f = open( '../' + page )

    Why when the user submits the form error is created?

    I need help passing an html form to my python script.

    Please ask me if i need to provide more information about anything.

    the mod rewrite rule is:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?page=$1 [L,PT,QSA]

    so for every html request to be handled by counter.py script
    Íéêüëáïò Êïýñáò, Mar 22, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chad Z. Hower aka Kudzu

    Separating code from design

    Chad Z. Hower aka Kudzu, Jan 23, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    412
    Chad Z. Hower aka Kudzu
    Jan 24, 2004
  2. Earl Teigrob
    Replies:
    3
    Views:
    560
    John Saunders
    Jun 10, 2004
  3. Manuel

    Separating html from code

    Manuel, Nov 29, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    319
    Manuel
    Nov 29, 2004
  4. lord0
    Replies:
    6
    Views:
    412
    Michiel Konstapel
    Dec 20, 2003
  5. Joe Laughlin

    Separating directory from file name: Code Review!

    Joe Laughlin, Jun 2, 2004, in forum: C Programming
    Replies:
    17
    Views:
    1,865
    Ike Naar
    Jun 14, 2004
Loading...

Share This Page