Lesson - 66 : Python Advanced - Python CGI Programming : Passing Information Using POST Method

Veröffentlicht am: 23 Januar 2018
auf dem Kanal: Sada Learning Hub
982
7

**************************************************
before watching this video please whatch this video to configure your setup    • Lesson - 62 : Python Advanced - Python CGI...  
Python Core PlayList :    • Lesson - 01 : Python3 - What is python  
Python Advanced PlayList :    • Lesson - 46 : Python Advanced - Python OOP...  
**************************************************

Python CGI Programming : Passing Information Using POST Method:
A generally more reliable method of passing information to a CGI program is the POST method. This packages the information in exactly the same way as GET methods, but instead of sending it as a text string after a ? in the URL it sends it as a separate message. This message comes into the CGI script in the form of the standard input.
Below is same hello_get.py script which handles GET as well as POST method.
Example :
#!/usr/bin/python
Import modules for CGI handling
import cgi, cgitb
Create instance of FieldStorage
form = cgi.FieldStorage()
Get data from fields
first_name = form.getvalue('first_name')
last_name = form.getvalue('last_name')
print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Hello - Second CGI Program</title>"
print "</head>"
print "<body>"
print "<h2>Hello %s %s</h2>" % (first_name, last_name)
print "</body>"
print "</html>”

<form action="/cgi-bin/hello_get.py" method="post">
First Name: <input type="text" name="first_name"><br /> Last Name: <input type="text" name="last_name" /> <input type="submit" value="Submit" />
</form>

Sample Projects : https://github.com/SadaLearningHub1/P...


Auf dieser Seite können Sie das Online-Video Lesson - 66 : Python Advanced - Python CGI Programming : Passing Information Using POST Method mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Sada Learning Hub 23 Januar 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 982 Mal angesehen und es wurde von 7 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!