- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to pass Text Area Data to Python CGI script?
Passing Text Area Data to CGI Program
TEXTAREA element is used when multiline text has to be passed to the CGI Program.
Here is example HTML code for a form with a TEXTAREA box −
<form action = "/cgi-bin/textarea.py" method = "post" target = "_blank"> <textarea name = "textcontent" cols = "40" rows = "4"> Type your text here... </textarea> <input type = "submit" value = "Submit" /> </form>
The result of this code is the following form −
Type your text here... Submit
Below is textarea.cgi script to handle input given by web browser −
#!/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('textcontent'): text_content = form.getvalue('textcontent') else: text_content = "Not entered" print "Content-type:text/html\r
" print "<html>" print "<head>"; print "<title>Text Area - Fifth CGI Program</title>" print "</head>" print "<body>" print "<h2> Entered Text Content is %s</h2>" % text_content print "</body>"
- How to pass Checkbox Data to Python CGI script?
- How to pass Radio Button Data to Python CGI script?
- How to pass Drop Down Box Data to Python CGI script?
- Passing Text Area Data to CGI Program in Python
- How to process a simple form data using Python CGI script?
- How to execute Python CGI Script on Apache Server?
- How to read all HTTP headers in Python CGI script?
- How to send the result of Python CGI script to the browser?
- Passing Checkbox Data to CGI Program in Python
- Passing Radio Button Data to CGI Program in Python
- How do I pass a variable to a MySQL script?
- Passing Drop Down Box Data to CGI Program in Python
- How to do CGI programming in Python?
- How to create a text area in JavaFX?
- How to setup cookies in Python CGI Programming?