0

我有一个带有多个下拉列表的 HTML 表单,在提交时,我会收到一个空白页。我让它使用单独的表单,但是一旦我添加了更多要提交的值,我就开始遇到问题。我正在从 public-html 和 cgi-bin 中的 cgi 脚本运行表单。我觉得这是非常基本的东西,但我似乎无法解决。下面是基本的 CGI 脚本,后面是表单。非常感谢您的帮助。

#!/usr/bin/python

# Import modules for CGI handling 
import cgi, cgitb 

# Create instance of FieldStorage 
form = cgi.FieldStorage() 

# Get data from fields
if form.getvalue('select01'):
   tier = form.getvalue('select01')
else
   tier = "Please Select Tier"

if form.getvalue('select02'):
   version = form.getvalue('select02')
else
   version = "Please Select Version"

if form.getvalue('select03'):
   point = form.getvalue('select03')
else
   point = "Please Select Audit Point"

print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Dropdown Demo</title>"
print "</head>"
print "<body>"
print "<h2> The Values Selected are %s, %s, %s </h2>" % (tier, version, point)
print "</body>"
print "</html>"

这是表格。抱歉,我正在使用 jquery 过滤第三个下拉列表,但没有包括它以节省空间。如您所见,我有 3 个下拉菜单,并希望在提交时将所有 3 个值发布到 cgi。

<section id="forms">

  <div class="row">
    <div class="span10 offset1">



      <form class="form-horizontal well" method="post" action="/cgi-bin/dropdown.py">
        <fieldset>
          <legend>Select Audit Point</legend>

          <div class="control-group">
            <label class="control-label" for="select01">Select Tier</label>
            <div class="controls">
              <select id="select01" name="select01">
                <option value="All Tiers">All Tiers</option>
                <option value="Database Tier">Database Tier</option>
                <option value="Application Tier">Application Tier</option>
                <option value="Web Tier">Web Tier</option>
              </select>
            </div>
          </div>

          <div class="control-group">
            <label class="control-label" for="select01">Select Version</label>
            <div class="controls">
              <select id="select02" name="select02">
                <option value="Oracle" name="Oracle">Oracle</option>
                <option value="SQL" name="SQL">SQL</option>
                <option value="Both" name="Both">Both</option>
              </select>
            </div>
          </div>

          <div class="control-group">
            <label class="control-label" for="select01">Select Audit Point</label>
            <div class="controls">
              <select id="select03" name="select03">
                <option value="Eagle Software Version">Eagle Software Version</option>
                <option value="Server OS, Memory, CPU">Server OS, Memory, CPU</option>
                <option value="High Availability">High Availability</option>
                <option value="DBMS Version">DBMS Version</option>
                <option value="DBMS Statistics">DBMS Statistics</option>
                <option value="DBMS Parameters">DBMS Parameters</option>
                <option value="DBMS Data File Growth">DBMS Data File Growth</option>
                <option value="Database Disk Structure">Database Disk Structure</option>
                <option value="Long Running SQL">Long Running SQL</option>
                <option value="Security Data Growth Range">Security Data Growth Range</option>
                <option value="Extraneous entries in System Tables">Extraneous entries in System Tables</option>
                <option value="Feed Error Orphans">Feed Error Orphans</option>
                <option value="Position Detail Orphans">Position Detail Orphans</option>
                <option value="Data Retention Policy">Data Retention Policy</option>
                <option value="Securities Added Daily">Securities Added Daily</option>
                <option value="Security Master Load">Security Master Load</option>
                <option value="SRM Purge">SRM Purge</option>
                <option value="Best Pricing Purge">Best Pricing Purge</option>
                <option value="Partitioning">Partitioning</option>
                <option value="DBMS Data/Log File Utilize Shared Disk">DBMS Data/Log File Utilize Shared Disk</option>
                <option value="DBMS Failover">DBMS Failover</option>
                <option value="DBMS Client Version">DBMS Client Version</option>
                <option value="Star Engine IP Configuration">Star Engine IP Configuration</option>
                <option value="Engine Count/Configuration">Engine Count/Configuration</option>
                <option value="STAR Engine Logging Interval">STAR Engine Logging Interval</option>
                <option value="PACE Engine Port Configuration">PACE Engine Port Configuration</option>
                <option value="PACE Server Logging">PACE Server Logging</option>
                <option value="PACE Engine Log Configuration">PACE Engine Log Configuration</option>
                <option value="STAR Engine Load Balancer Interval">STAR Engine Load Balancer Interval</option>
                <option value="Engines Restarted Weekly">Engines Restarted Weekly</option>
                <option value="Designated Master">Designated Master</option>
                <option value="Cluster Managers Identical">Cluster Managers Identical</option>
                <option value="Uploader Shared Disk Space">Uploader Shared Disk Space</option>
                <option value="Custom Archive Rule Shared Disk Space">Custom Archive Rule Shared Disk Space</option>
                <option value="App Server Clustering">App Server Clustering</option>
                <option value="PACE Event Concurrency">PACE Event Concurrency</option>
                <option value="Homogenous Engine Configuration">Homogenous Engine Configuration</option>
                <option value="Log Levels">Log Levels</option>
                <option value="Scheduler Purging">Scheduler Purging</option>
                <option value="Web Server Services Restarted Weekly">Web Server Services Restarted Weekly</option>
                <option value="Email Notification Basic Configuration">Email Notification Basic Configuration</option>
                <option value="Eagle Web Load Balancer Configuration"n>Eagle Web Load Balancer Configuration</option>
                <option value="Load Balancer Customizations">Load Balancer Customizations</option>
                <option value="Portal Shared Disk Space">Portal Shared Disk Space</option>
                <option value="Message Center Shared Disk Space">Message Center Shared Disk Space</option>
                <option value="Message Center ID'S">Message Center ID'S</option>
                <option value="Schedule Service Config">Schedule Service Config</option>
                <option value="ePace is a client of Clustered App Servers">ePace is a client of Clustered App Servers</option>
                <option value="Portal is a client of Clustered App Servers">Portal is a client of Clustered App Servers</option>
                <option value="ESTAR is a client of Clustered Load Balancers">ESTAR is a client of Clustered Load Balancers</option>
                <option value="ESTAR is a client of Clustered Engines">ESTAR is a client of Clustered Engines</option>
                <option value="ESTAR is a client of Clustered Report Export Services">ESTAR is a client of Clustered Report Export Services</option>
                <option value="WebSync Configured">WebSync Configured</option>
                <option value="Web Server Load Balancing Configured">Web Server Load Balancing Configured</option>
                <option value="Shared Disk Dynamic Folder">Shared Disk Dynamic Folder</option>

              </select>
            </div>
          </div>


          <div class="form-actions">
            <button type="submit" class="btn btn-primary" value="Submit">Submit</button>
            <button type="reset" class="btn">Cancel</button>
          </div>
        </fieldset>
      </form>
    </div>
  </div>

</section>
4

1 回答 1

1

您的 else 语句后缺少冒号。

else:
于 2013-07-18T19:00:35.417 回答