Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the selected option in a Python CGI script from a html select/option
    primarykey
    data
    text
    <p>I have been working on getting a python CGI script to work all day, and I am now at near the final hurdle, but I have run into a problem that I cant seem to find an answer for...</p> <p>Its in 2 parts so here goes:</p> <p>I am generating the following html code:</p> <pre><code> &lt;form action="selections.cgi" enctype="multipart/form-data" method="POST"&gt; &lt;input type="hidden" name="captureSelection"/&gt; &lt;select name="cboOptions"&gt; &lt;option value="1"&gt;Option 1&lt;/option&gt; &lt;option value="2"&gt;Option 2&lt;/option&gt; &lt;option value="3"&gt;Option 3&lt;/option&gt; &lt;option value="4"&gt;Option 4&lt;/option&gt; &lt;option value="5"&gt;Option 5&lt;/option&gt; &lt;option value="6"&gt;Option 6&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; </code></pre> <p>Note: apologies I am unable to get the HTML into a code block..</p> <p>This html code creates a form that only has a combo box in it. What I want is to be able to get the user to select an item from the combo box and for the script to be run. Is it possible WITHOUT using javascript to be able to get the selection to submit, like the input submit button does in regular forms? Or is a button needed to capture the input, if im not using javascript?</p> <p>Now for the second part:</p> <p>I am using the hidden field in the example above to make sure I call the correct function in my CGI/PYTHON script and so far that works. But I haven't been able get the value from the selected option back from the form, and I havent been able to find an code references online written in PYTHON that will allow me to get the value of the selected option.</p> <p>Is this possible and how is it done, if you have a link to an example that would be better...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload