Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Welcome to the Monastery
 
PerlMonks  

Re: retrieve dynamic form data

by cbrandtbuffalo (Deacon)
on Nov 22, 2005 at 16:13 UTC ( [id://510907]=note: 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.


in reply to retrieve dynamic form data

Assuming you're using CGI, you can use the param method to return all of the form parameters passed in. One of the nice things about param is that you can use it in list context, so you can loop through or grab the names of all params, so you can do:
my @names = CGI::param; for my $name ( @names ){ # Get each value. my $value = CGI::param($name); # Do something with the value. }

Replies are listed 'Best First'.
Re^2: retrieve dynamic form data
by Anonymous Monk on Nov 22, 2005 at 16:59 UTC
    I have tried doing this but the array always comes back empty. Any idea why?
      I don't know for sure, but the simple reason would be that no parameters are being passed to the script. You could test this, even just to rule it out, by putting a hidden field in your form with a known value or even putting some query params at the end of the 'action' line in your form tag. I wouldn't recommend doing this permanently, but it can help debug. For example, in your form, you could:
      <form action="http://my.site.com/script.pl?test1=one">
      How are you testing whether the params are coming back? Just printing back to the browser? Because it's also possible that you are getting them, but you aren't displaying them properly. Can you show some code?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://510907]
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.