on-rev example: dynamic table (was: 'globals.cgi' conversion)
revlist at azurevision.co.uk
Sun Apr 19 17:03:56 CDT 2009
On 18 Apr 2009, at 09:33, Andre.Bisseret wrote:
> I was expecting something like a beautiful web page ;--))
This isn't much more beautiful, but it's less like a system readout. ;-)
Put in two numbers and hit 'Submit' to see a 'times table'-like table
appear. Nothing all that special and I'm sure it could also be done in
PHP, but it would have taken me longer to remember how to do a repeat
in PHP than the whole thing did via rev/transcript.
The Rev code looks like this:
put "<table cellpadding='2'>"
repeat with x = 1 to $_POST["x"]
repeat with y= 1 to $_POST["y"]
put "<td>" & (x * y) & "</td>"
Which is nice and familiar. Given the power of Transcript/Rev, it
would be easy to add in some sophisticated error-checking code for
letters instead of numbers, and instead put a sensible error message
if someone puts in garbage.
More information about the use-livecode