summaryrefslogtreecommitdiff
path: root/swat/esptest/formtest.esp
blob: 89e542c55291c12077354eb95850006b40a40d1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<% page_header("columns", "ESP Form Test"); %>

<form name="FormTest" method="POST" action="@@request['SCRIPT_NAME']"> 
    firstName: <input name="firstName" type="text" value=""><br>
    lastName:  <input name="lastName"  type="text" value=""><br>
    <input name="submit" type="submit" value="OK">
    <input name="submit" type="submit" value="Cancel"><br>
</form>

<%
  /* if its a post then the user has filled in the form, so
     report the values 
  */
  if (request['REQUEST_METHOD'] == "POST") {

  /* if they cancelled then take them back to the list of tests */
  if (form['submit'] == "Cancel") {
     redirect("/");
  }
%>
  You chose firstName=@@form['firstName'] lastName=@@form['lastName']
<%

   function showArray(name, array) {
      write("<h3>Array: " + name + "</h3>\n");
      for (v in array) {
            write(name + "[" + v + "]=" + array[v] + "<br>\n");
      }
   }

   showArray("form",    form);
  }
%>

<% page_footer(); %>