File tree 5 files changed +308
-102
lines changed
Filter options
5 files changed +308
-102
lines changed
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ function myserver() % called from C
7
7
case ' /bob'
8
8
% webserver.template('templates/home.html', values);
9
9
stllog(' in /bob' );
10
+ if webserver .isGET()
11
+ stllog(' GET request' );
12
+ end
10
13
a = webserver .getarg(' a' );
11
14
if ~isempty(a )
12
15
stllog(' a = %s ' , cstring(a ));
@@ -19,4 +22,15 @@ function myserver() % called from C
19
22
webserver .template(' templates/alice.html' , vals );
20
23
case ' /duck'
21
24
webserver .file(' duck.jpg' , ' image/jpeg' );
25
+ case ' /input'
26
+ if webserver .isPOST()
27
+ stllog(' POST request' );
28
+ foo = webserver .postarg(' Foo' );
29
+ stllog(' foo = %s ' , cstring(foo ));
30
+ else
31
+ stllog(' GET request' );
32
+ end
33
+ webserver .template(' templates/input.html' );
34
+ end
35
+
22
36
end
Original file line number Diff line number Diff line change
1
+ < html >
2
+ < body >
3
+ < p > This is a page to test POST</ p >
4
+ < form action ="" method ="post ">
5
+ < p > Enter value of foo:
6
+ <!-- POST key = Foo, POST value is entered tect -->
7
+ < input type ="text " value ="0 " name ="Foo " />
8
+
9
+ <!-- button label is given by value, POST key = button, POST value = Button1/2 -->
10
+ < p > < input type ="submit " value ="Button1 " name ="button " /> </ p >
11
+ < p > < input type ="submit " value ="Button2 " name ="button " /> </ p >
12
+ </ form >
13
+ </ body >
14
+ </ html >
You can’t perform that action at this time.
0 commit comments