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

im trying to write a form script but when I do this

print start_form(); print p("Document nr: ", textfield("doc_nr")); print p("Document name: ", textfield("doc_name")); print p("Author: ", popup_menu("author", \@authors)); print p(submit("DO"), reset("clear")); print end_form(), hr(); $data = (param("doc_nr") . param("doc_name") . param("author") . l +ocaltime() . "\n");
I get a "Use of uninitialized value" message on the $data ... line

Replies are listed 'Best First'.
Re: problem with using data
by davorg (Chancellor) on Jul 31, 2001 at 15:17 UTC

    That's because one of your form fields hasn't been filled in.

Re: problem with using data
by tachyon (Chancellor) on Jul 31, 2001 at 16:14 UTC

    Add this debugging code (replace the current $data = .... line with all this:

    my $doc_nr = param('doc_nr') || 'undef'; my $doc_name = param('doc_name') || 'undef'; my $author = param('author') || 'undef'; my $time = localtime(); $data = $doc_nr.$doc_name.$author.$time."\n";

    This will work as all elements will now be defined and you will be able to see the problem.

    cheers

Re: problem with using data
by CyCliC (Novice) on Jul 31, 2001 at 15:32 UTC
    well the script works perfect when runing it command-line
    but when I run it in my browser (with all the fields filled)
    nothing happens