Look at the address bar. You submitted 2 HTTP parameter(s).
| Name | Value |
| a | 1 |
| b | 3 |
Source for this SHP file:
#!/home/jdenny/public_html/share/shp/0.14/bin/shp
Content-type: text/html
<?xml version="1.0" encoding="iso-8859-1"?>
<$setenv>LD_LIBRARY_PATH<$:>/usr/local/gcc/lib/gcc/sparc-sun-solaris2.9/3.4.1<$/setenv>
<$open_server>python_server<$/open_server>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>
SHP/CGI/Python Example
</title>
<style type="text/css" media="screen">
table {
border: ridge gray;
border-width: 3px 0px 0px 3px;
}
table td {
border: ridge gray;
border-width: 0px 3px 3px 0px;
padding: 7px;
}
table thead td {
font-weight: bold;
}
</style>
<$talk>python_server<$:>
global cgi, form, i_param_count
import cgi
form = cgi.FieldStorage()
i_param_count = len( form )
<$/talk>
</head>
<body>
<h1>SHP/CGI/Python Example</h1>
<p>
Look at the address bar.
You submitted
<$talk>python_server<$:>
print i_param_count
<$/talk>
HTTP parameter(s).
</p>
<table cellspacing="0">
<thead>
<tr>
<td>Name</td>
<td>Value</td>
</tr>
</thead>
<tbody>
<$talk>python_server<$:>
for s_name in form:
s_name = s_name.replace( "&", "&" )
s_name = s_name.replace( "<", "<" )
s_name = s_name.replace( ">", ">" )
s_value = form[ s_name ].value.replace( "&", "&" )
s_value = s_value.replace( "<", "<" )
s_value = s_value.replace( ">", ">" )
print " <tr>"
print " <td>%s</td>" % s_name
print " <td>%s</td>" % s_value
print " </tr>"
<$/talk>
</tbody>
</table>
<p>
Source for this SHP file:
</p>
<pre style="border: ridge grey 3px;"><$"->
<$talk>python_server<$:>
r_file = file( "example_python.shp.cgi", "r" )
for s_line in r_file:
s_line = s_line.replace( "&", "&" )
s_line = s_line.replace( "<", "<" )
s_line = s_line.replace( ">", ">" )
s_line = s_line.replace( "\n", "" )
print s_line
<$/talk><$"->
</pre>
</body>
</html>
<$close_server>python_server<$/close_server>