Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

submit button fails to pass the values using perl cgi?

by finddata (Sexton)
on Mar 30, 2017 at 09:41 UTC ( [id://1186469]=perlquestion: print w/replies, xml ) Need Help??

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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: submit button fails to pass the values using perl cgi?
by marto (Cardinal) on Mar 30, 2017 at 09:56 UTC

    It looks like you're going to continue to ignore all the advice everyone gives you, but as a final attempt:

    • When posting the code should be short and able to reproduce the problem you claim. How do I post a question effectively?.
    • Doesn't it strike you as odd that you have an end_form but no start_form?
    • CGI states that:
    • "All HTML generation functions within CGI.pm are no longer being maintained. Any issues, bugs, or patches will be rejected unless they relate to fundamentally broken page rendering.

      The rationale for this is that the HTML generation functions of CGI.pm are an obfuscation at best and a maintenance nightmare at worst. You should be using a template engine for better separation of concerns. See CGI::Alternatives for an example of using CGI.pm with the Template::Toolkit module."

    • Read the previous replies you already have regarding the above, or continue to ignore them should you wish to continue to make life difficult for yourself.
    • Consider that people will likely get bored of your behaviour and simply stop answering you.
    • If you aren't interested and don't like programming or problem solving ask yourself if you've chosen the right job/course to attend.
      > Consider that people will likely get bored of your behaviour and simply stop answering you.

      Some will continue as long as they get upvoted.

      That's why I stop voting in these threads

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        This again, until vroom enables the XP to BTC gateway who cares? ;)

        This again, until vroom enables the XP to BTC gateway who cares? ;)

Re: submit button fails to pass the values using perl cgi?
by huck (Prior) on Mar 30, 2017 at 10:13 UTC

    As marto has pointed out, you are deficient in your examples. what you have posted will not work period. Luckily for you I can understand clueless newbie speak, and this works just fine for me.

    #!/usr/bin/perl use strict; use warnings; select STDOUT; $| = 1; use CGI ':standard'; # 1186469.pl print header(); my $ispopup1=param('popup1'); $ispopup1='' unless (defined($ispopup1)); print 'Popup1:'.$ispopup1.'<br>'."\n"; print start_form(); print " <br> &nbsp<B>Sort</B> &nbsp"; my $site_selected="Building"; #@values=@columns; my @values = ('Building', 'Nepal','West','Landmark'); print popup_menu( -name => 'popup1', -values => \@values, -default => 'value2' ); print "&nbsp &nbsp &nbsp &nbsp &nbsp "; #print hidden(-name =>"view", # -value => $CGI_PARAM{'view'}); print submit('submit'); print end_form;
    So just what is your problem? Do you not understand cgi at all either? Just what did you expect to happen that didnt happen? Just what did you expect not to happen that did happen? Can you post a proper question at all?

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: submit button fails to pass the values using perl cgi?
by Anonymous Monk on Mar 30, 2017 at 15:24 UTC
    I'm guessing that you've rolled your own parameter-parsing code, and that it doesn't understand POST data. Try replacing your first line with this:
    print start_form(-method=>'GET');
    Also, learn to use the parameter methods provided by the CGI module.
      "GET"! That solved it for me!Thank you!!!
        Yeah, but keep in mind that when you use GET to send data, the form values are sent through the URL string. So, that's not very secure...

        If you use "POST" to submit form data, then you have to read those from STDIN in your perl script like so:

        # Usage: STRING = GetFormData()
        # Returns the form content as one giant string.

        sub GetFormData
        {
        my @L;
        while (<STDIN>)
        { push @L, $_; }
        @L or return '';
        return join('\n', @L);
        }

        ...

        my $FORM_DATA = GetFormData();

        (My Disclaimer: I'm a beginner perl programmer myself, so... what I say may not be 100% correct. LOL)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1186469]
Approved by Marshall
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-20 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found