wrote:
> I was just reading about cgi.pm in the mouse or rat book
> by o'reily (whatever its called).
They call it a mouse. I like your rat idea better.
> still be generating a seperate html page and moving away from
> my original index page? Is that true?
Yeah - there's really no way around that with CGI. You can't modify the
page in-place, all you can do is send a new page.
What you *can* do though, is send a page that's virtually identical to
the one with the form.
> Ahh the questions, it would be so much easier if I was able to
> see this in action on the web.
Here's a simple example:
#!/usr/bin/perl -T
use strict;
use warnings;
use CGI;
my $q = new CGI;
print $q->header;
my $formtag = $q->start_form;
my $nametag = $q->textfield('name');
print <<HTML;
<html>
<body>
$formtag
What's your name? $nametag<br>
<input type="submit">
</body>
</html>
HTML
When you use the textfield() method above, it looks for an input named
'name' in the query. If it finds one, it uses it to generate a value=""
attribute for the <input ...> element.
Similarly, the start_form() method produces a <form ...> element with an
action="" method that refers back to this script.
That's the basic idea - the CGI.pm methods that produce form elements
take the values assigned to those elements from the form input. This
makes it easy to build self-referential forms like you're describing.
sherm--
--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
Hire me! My resume:
http://www.dot-app.org