CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
The State of a form

 



SirAnvil
Deleted

Feb 23, 2001, 2:00 PM

Post #1 of 3 (391 views)
The State of a form Can't Post

I was playing w/ CGI.pm and using it's feature to save the state of a form to a file. I loose info somewhere and could not figure out where so I got the bright Idea of doing basically what the CGI.pm was already doing to see if I can prevent that leak.

I save a list of all my name/value pairs to a file much like this
food=pizza
toy=buzz lightyear
music=huh?

Okay so now that it's sitting pretty in a nice file, I want to call that file and place each name/value pair in variables. Each variable being identical to the name and it's contenst being the value.

Does anyone have a slick code piece to perform this seemingly simple task? If so, could I possably get an explenation of the said code snip?

SirAnvil
www.christiangamers.org


japhy
Enthusiast

Feb 24, 2001, 6:01 AM

Post #2 of 3 (385 views)
Re: The State of a form [In reply to] Can't Post

Don't do that. Don't make individual variables for each one. Use a the CGI object. Your method will break with checkboxes, multiple-select, or any other field that is duplicated.


Code
use CGI; 
open INPUT, "query-file";
my $quer = CGI->new(\*INPUT);
close INPUT;

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author


SirAnvil
Deleted

Feb 24, 2001, 7:18 AM

Post #3 of 3 (383 views)
Re: The State of a form [In reply to] Can't Post

so doing it this way would allow me to refer to the object any time I need it right?

name=value

$something = $query->param('name');
do something with $something

Is that what your saying? So if that's right then I can pull the info as I need it and not all at one time right? Or am I missing the point all together?

---
as for my original problem I figured out what it was. I knew the leak was not the CGI.pm and somewhere in my code and it was. <g>

SirAnvil
www.christiangamers.org

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives