Separating design from code

  • Thread starter Íéêüëáïò Êïýñáò
  • Start date
Í

Íéêüëáïò Êïýñáò

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,922
Messages
2,570,047
Members
46,473
Latest member
DaveBrowde

Latest Threads

Top