# simple.icn

link cgi     # This links the PRECOMPILED cgi library and makes
             #   those functions available to you.

procedure cgimain()   # This is the start of the script
   host := getenv("REMOTE_ADDR")  # This is an example of using the
                                  # Environment variables to get info.
   write("Submitted IP address: ", host,"<br>")
   write("Submitted on: ", &dateline)

   # Example reading form input specified in simple.html line 15.
   write("<br>Hello, ", cgi["name"], " welcome to the output page.<br>")
   write("Your age is: ", cgi["age"], "<br>")
   write("And I see you enjoy:")
   write(if cgi["pizza"] === "on" then "Pizza" else "", " ",
      if cgi["burger"] === "on" then "Hamburgers" else "", " ",
      if cgi["taco"] === "on" then "Tacos" else "", " ")
   write(" for every meal.<br>")

   write("And your favorite color to look at is")
   write(if cgi["red"] === "on" then "Red<br>" else "", " ",
          if cgi["green"] === "on" then "Green<br>" else "", " ",
          if cgi["blue"] === "on" then "Blue<br>" else "", " ")
  
    write("Education: ")
    write(if cgi["bs"] === "on" then "BS<br>" else "", " ",
          if cgi["ms"] === "on" then "MS<br>" else "", " ",
          if cgi["phd"] === "on" then "PHD<br>" else "", " ")
    write("<br><br>")
  
    write("Your words of wisdom are:<br><br>  ",cgi["comments"],"<br>")
  
    write("<br><br><center>If you changed your mind... ")
    write("<a href=\"simple.html\"> You can always Go Back!</a>")
    write("  fix it  and re submit it!</center><br><br>")
  
end
