[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Web development with Lua
- From: Peng Zhicheng <pengzhicheng1986@...>
- Date: Mon, 17 Oct 2011 22:06:38 +0800
于 2011-10-17 21:22, Luciano de Souza 写道:
Step by step, let me describe what I could understand.
[...]
But how to connect "name", the Lua variable and "name", the HTML variable?
the cgilua would handle the varibles for you, then you can access them
from cgilua.GET and cgilua.POST table, depending how the data are committed.
see the documents and examples.
the examples from the cgilua codebase is very short and comprehensive,
you should check it.
a short description here:
the login.lp page contains forms of username and pass,
and the check.lua script checks them for validation,
and redirects to another page on success, or otherwise
re-display login.lp again with the username already filled.
Note though, the login.lp has a small error: the `action' attribute of the form
should point to the URL of "check.lua" script, which SHOULD be run
by the web server as a CGI program if properly configured. you might need to
insert a `shebang line' pointing to a lua interpretor.
[1] login.lp : https://github.com/keplerproject/cgilua/blob/master/examples/login.lp
[2] check.lua: https://github.com/keplerproject/cgilua/blob/master/examples/check.lua