Difference between revisions of "Conf/Examples/CgiConfig/TclParamExample"
Jump to navigation
Jump to search
Line 19: | Line 19: | ||
puts "<html><head><title>CGI Reply Page - via Tcl</title></head>" | puts "<html><head><title>CGI Reply Page - via Tcl</title></head>" | ||
puts "<body bgcolor=white>TCL used in CGI - First Demo" | puts "<body bgcolor=white>TCL used in CGI - First Demo" | ||
− | puts " | + | puts "foo: $form(foo)" |
− | puts " | + | puts "bar: $form(bar)" |
puts "</body>" | puts "</body>" |
Latest revision as of 13:02, 30 December 2011
#!/usr/bin/tclsh8.5
set params [split $env(QUERY_STRING) &] foreach par $params { set pair [split $par =] set name [lindex $pair 0] set value [lindex $pair 1] regsub -all \\\+ $value " " value # Convert url-encoded characters like %20 regsub -all -nocase {%([0-9a-f][0-9a-f])} $value \ {[format %c 0x\1]} value set form($name) [subst $value] }
puts "Content-type: text/html\n"
puts "<html><head><title>CGI Reply Page - via Tcl</title></head>" puts "<body bgcolor=white>TCL used in CGI - First Demo" puts "foo: $form(foo)" puts "bar: $form(bar)" puts "</body>"