You should really use python's docstrings, then you dont need to print each line such as
and you cant link the script as if its in the same directory. You have to make the path to from root. Most likely on a linux server your cgi would be in a cgi-bin directory, so even though the scripts are in the same directory, you still need to link it from the root directory.
so lets say html is the root
/var/www/html
and your scripts live here
/var/www/html/cgi-bin
even though both CSS and your cgi script are in cgi-bin, you need to use
<link type="text/css" rel="stylesheet" href="/cgi-bin/styles.css" />
instead
html = """Content-type: text/html <html> <head> <link type="text/css" rel="stylesheet" href="/cgi-bin/styles.css" /> </head> <body> <select> {OPTIONS} </select> <p> My text </p> </body> </html> """.format( OPTIONS=html_list, ) print(html)It also makes it quicker and easier to plugin a value like OPTIONS here. NOTE: you do need the blank line on line 2.
and you cant link the script as if its in the same directory. You have to make the path to from root. Most likely on a linux server your cgi would be in a cgi-bin directory, so even though the scripts are in the same directory, you still need to link it from the root directory.
so lets say html is the root
/var/www/html
and your scripts live here
/var/www/html/cgi-bin
even though both CSS and your cgi script are in cgi-bin, you need to use
<link type="text/css" rel="stylesheet" href="/cgi-bin/styles.css" />
instead
Recommended Tutorials: