Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Is $formdata present?

by tchatzi (Acolyte)
on Jun 07, 2005 at 08:49 UTC ( [id://464191]=note: print w/replies, xml ) Need Help??


in reply to Is $formdata present?

I think you should consider reading the documentation of CGI. You can find it here CGI .
It will be easier for you, if you use CGI to work with forms.

``The wise man doesn't give the right answers, he poses the right questions.'' TIMTOWTDI

Replies are listed 'Best First'.
Re^2: Is $formdata present?
by Anonymous Monk on Jun 07, 2005 at 09:03 UTC
    Correct. CGi.pm will work for both POST and GET. For existence u couldd use something like..
    use CGI qw(:standard); my %formdata = (); map { $formdata{$_} = param($_); } param; if(exists $formdata{'parametername'}) {do something;}

    20050606 Janitored by Corion: Added formatting, put code in between <code>...</code> tags

      While using CGI.pm is a good thing, you still made it more complicated than it should be, at least if you ask me ...
      use strict; use CGI; my $q = new CGI; my $form = $q->Vars(); if(exists $form->{parameter_name}){ #do whatever }
      Of course, you can also use Data::FormValidator. It's suggested if you need more complicated form validation.
      And multipart-formdata encoding also, which you simply ignored.
      So what's the difference functionally between Defined and Exists? I thought Exists was used for subroutines and hashes? (clearly wrong)..
      Sorry.. I'm new. Will soon register myself and format my code. But my answer should work for you.
      Happy Coding

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-19 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found