[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

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?
1 Solution
First make sure that you put all form details inside tghe form like this:

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

<input type="submit">


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'};

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


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


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:


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!

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now