RPGMinerva has asked for the wisdom of the Perl Monks concerning the following question:

ok here's my problem. I've started coding an a register script (register.cgi) for my site's member system but I can't get the script to include the fill-out form and the processing part (even I've seen many programs ..etc. Ikonboard with working system where the fill out stuff and processing stuff are at the same file). Currently the code is somewhat like this:
# opening tags and stuff.... if ($action eq "filled") { # ..create member file..check stuff.. } else { # html stuff and the form is sent back to "register.cgi" $action = "filled"; }
How I could get this working properly? :\

Edit: Added <code> tags and # at the beginning of comments. larsen

update (broquaint): title change (was Annoying problem)

Replies are listed 'Best First'.
Re: Annoying problem
by tachyon (Chancellor) on Dec 25, 2002 at 15:28 UTC

    You need this sort of basic structure. This will run as is. Just add code to finish :-)

    #!/usr/bin/perl -w use strict; use CGI; my $q = new CGI; print $q->header(); if ( $q->param('filled') eq 'this form' ) { # the user submitted the form so process it # here we get the value the user put into the username field my $username = $q->param('username'); # display some sort of thank you page print "You submitted $username"; } else { # the script was not called by the form below so show the form print <<HTML; <form action="http://mysite.com/cgi-bin/myscript.pl" method="post"> <input type="hidden" name="filled" value="this form"> <p>Username: <input type="text" name="username"> <p><input type="submit" name="submit" value="Submit Form"> HTML } exit;

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Annoying problem
by cLive ;-) (Prior) on Dec 25, 2002 at 15:48 UTC
Re: Annoying problem
by CountZero (Bishop) on Dec 25, 2002 at 20:28 UTC

    You will of course be using the CGI module, won't you?

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Annoying problem
by jdporter (Paladin) on Dec 25, 2002 at 13:38 UTC