Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

cgi sumbit no-worky

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

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 17: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 cfreak (Chaplain) on Aug 06, 2003 at 18: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!
Re: cgi sumbit no-worky
by valdez (Monsignor) on Aug 06, 2003 at 17: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 17:52 UTC
    You're using the OO CGI interface, no need for the "qw(:standard)" in the second line.

    rdfield

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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-03-29 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found