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

preview_player
Показать описание
**************************************************
**************************************************

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.
Example :
#!/usr/bin/python
# Import modules for CGI handling
import cgi, cgitb
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
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>”

First Name: <input type="text" name="first_name"><br /> Last Name: <input type="text" name="last_name" /> <input type="submit" value="Submit" />
</form>

Рекомендации по теме
Комментарии
Автор

wanted to know if there was a way to get post data from javascript to python cgi

binaydhawa
visit shbcf.ru