PDA

View Full Version : Subparseform results


<htmlite>
12-18-2001, 10:04 AM
Yup, another one...

Partial code

require "subparseform.lib";
&Parse_Form;

$webpage = $formdata{'webpage'};
$email = $formdata{'email'};
$info = $formdata{'info'};


Ok, that is fine if I know the names given to the specified form fields, but...

How do I create a generic info rendering thing?
Like make it go through the subparseform then after have a hash hold the info of the keys and values or something. Bascially I want an all purpose thing so I don't have to go through tons of form pages and figure out what names I have to input like above.

Cheers!

Modulus
12-18-2001, 11:49 AM
So you want to return data from a specified subroutine? If so, just use return().

perldoc return

:)

<htmlite>
12-18-2001, 12:12 PM
Um... I don't think so...
Basically be able to take this part...
$webpage = $formdata{'webpage'};
$email = $formdata{'email'};
$info = $formdata{'info'};

All those parts specified in the $formdata brackets, as it stands I have to know what all the NAME fields are to extract the information and put it into the variables. Is there anyways of putting those NAMEs (with associated values) into an array (or hash) insteas so it would be like...

%hashthing=$formdata
so I have all the pairs extracted. this way I can have different form names and a different number of information entering into the subparse form.

basically I want to automate that specified part above. After that I will be emailing the results since it is a feedback form.

Modulus
12-18-2001, 12:31 PM
I still think you are overcomplicating it.

Take those 3 lines above into the subroutine and then return each $string. Then you have those strings in your other file.

<htmlite>
12-18-2001, 11:59 PM
Originally posted by Modulus
I still think you are overcomplicating it.

Yup, I tend to do that all too often ;)

I did find a result though. After the ParseForm sub, I put this...

while (($key, $value) = each (%formdata) {
print "Key is $key and value is $value<br>";
}

Which also works as...

foreach $key (keys(%formdata)){
print "Key is $key and value is $formdata{$key}<br>";
}

Thanks for your answers though!
Cheers!