Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

cgi sumbit no-worky

by Anonymous Monk
on Aug 06, 2003 at 13:36 UTC ( [id://281519]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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

Oh Venerable ones,

I have the following code

@machines=("a", "b", "c"); use CGI qw(:standard); $q = new CGI; #$q->use_named_parameters(1); print $q->header(-title=>'SI', -author=>'me'), $q->p, $q->start_html('Welcome'), $q->p, $q->h1('Welcome'), $q->h3('Which machine would you like to Analyize?'), $q->popup_menu(-name=>'machines', -values=>\@machines), $q->p, $q->submit; $machine=$q->param('machines'); $q->end_html; if ($q->params) { <do some stuff> }

The if section is never executed. Please help.

Replies are listed 'Best First'.
Re: cgi sumbit no-worky
by MrCromeDome (Deacon) on Aug 06, 2003 at 13:44 UTC
    CGI no starty form ;) You may wish to stick a $q->start_form() and $q->end_form() in and see where it gets you.

    Cheers!
    MrCromeDome

Re: cgi sumbit no-worky
by valdez (Monsignor) on Aug 06, 2003 at 13:51 UTC

    What happens if you add $p->start_form before $p->popup_menu and $p->end_form after $p->submit?

    Ciao, Valerio

Re: cgi sumbit no-worky
by rdfield (Priest) on Aug 06, 2003 at 13:52 UTC
    You're using the OO CGI interface, no need for the "qw(:standard)" in the second line.

    rdfield

Re: cgi sumbit no-worky
by cfreak (Chaplain) on Aug 06, 2003 at 14:09 UTC

    As others have said the lack of $q->start_form and $q->end_form is the probable culprit. Whenever you can't get a form to submit or something just doesn't display correctly on your page make sure to view the HTML source that your program spit out, in this case you could have seen that your form had no form tags and thus was not being sent at all.

    Hope that helps,
    Chris

    Lobster Aliens Are attacking the world!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://281519]
Approved by MrCromeDome
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.