Content-Type: text/html
<html>
<head><title>CGI Program</title></head>
<body>
Traceback (most recent call last):
File "./hello_get.py", line 18, in <module>
print "<h2>Hello &s &s</h2>" % first_name, last_name
TypeError: not all arguments converted during string formatting
This is my code, any help would be much appreciated.
- Code: Select all
#!/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"
print "<html>"
print "<head><title>CGI Program</title></head>"
print "<body>"
print "<h2>Hello &s &s</h2>" % first_name, last_name
print "</body>"
print "</html>"
