send hidden

at the end of a form i have a submit button but want to send the value $temp with the form without the user knowing


i had
print "<br></table><Input type=submit>\n";
and tried to change it to.....
print "<br></table><Input type=hidden name=submit value=$temp>\n";


but to no avail....
also how do i extract that value back when its sent to the script?
is it Query_string?
thanks
   
boofullsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

guadalupeCommented:
First make sure that you put all form details inside tghe form like this:

<input type="hidden" name="temp" value="$temp">

<input type="submit">

</form>

Then to recollect the value temp use the following sub routine placed at the end of your code:

#---------------------------------Parse Input---------------------------------------#
#                  Arguments:      NONE                                                                                    #
#                  Purpose            Standard Form/Query String Parsing                                          #
#                  Calls:            NONE                                                                                    #
#-----------------------------------------------------------------------------------#

sub parseInput()
{
      #Parse form variables
      if ($ENV{'REQUEST_METHOD'} eq "POST")
      {
            read(STDIN, $temp, $ENV{'CONTENT_LENGTH'});
      }

      elsif ($ENV{'REQUEST_METHOD'} eq "GET" )
      {
            $temp = $ENV{'QUERY_STRING'};
      }

      @pairs=split(/&/,$temp);
      
      foreach $item(@pairs)
      {
            ($key,$content)=split (/=/,$item,2);
            $content=~tr/+/ /;
            $content=~ s/%(..)/pack("c",hex($1))/ge;
            $fields{$key}=$content;
      }

}

BUT!!!!!!!!!!!!!!!! call the subroutine before you will need any of the values from the from, like this:

&parseInput;

Do it at the begining of the script to be safe.  This sub puts all values sent the a file in a hash called %fields you can access the hidden field temp' value by using:

$fields{'temp'}

If you have a text field called text1 you can get its value using:

$fields{'text1'} and so on for every field in the form.

BECAREFULL Radio buttons and checkboxes are special.  Ceck boxes on exist as values sent if they are checked (this is standard) so the value

$fields{'checkbox1'} will only have a defined value if it was checked.  This is the same for radio buttons...

Hope this helps!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.