forked from MrSyabro/lua_http_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform_test.lua
More file actions
26 lines (22 loc) · 830 Bytes
/
form_test.lua
File metadata and controls
26 lines (22 loc) · 830 Bytes
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
local h = require "html"
local page = dofile "page.lua"
local lead = {class = "lead"}
local args = request.args
if request.method == "POST" then
local data, err = client:receive(request.headers["content-length"])
if data then
args = server.parseurlargs(data)
end
end
local out = h.p(lead, "Вы не ввели имя или фамилию?")
if args.firstname and args.lastname then
out = h.p(nil, "Вас зовут: ", h.b(nil, args.firstname), " ", h.b(nil, args.lastname))
end
echo(page("Form out",
h.div({ class = "container" },
h.h2(nil, "GET/POST example"),
h.hr(),
h.p(lead, "На этой странице обрабатываются даныне запроса. Ниже отображены введенные в форме данные:"),
out
)
))