Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How do I get data from a web form (the correct way)?

by andyram27 (Initiate)
on Apr 25, 2002 at 02:22 UTC ( [id://161839]=note: print w/replies, xml ) Need Help??


in reply to How do I get data from a web form (the correct way)?

Same thing bugged the hell out of me. Here's how I do it. This program takes input from a generated form and prints it to the browser.

Make sure you have CGI.pm installed

#!usr/bin/perl -w #include warning switch #loads CGI with standard shortcuts use CGI qw/:standard/; #good for keeping track of variable scope, etc use strict; my $name = param('name') || ''; if($name) { &page2; } else { &page1; } sub page1 { print header; print '<form method="post" action="thisfile.pl">'; print '<input type="text" name="name">'; print '<input type="submit" value="submit">'; print '</form>'; } sub page2 { print header; print 'Hi, '.$name.', your variable has been submitted.'; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-20 14:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found