Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I want to receive 1 or 2 input values

Posted on 2000-03-16
1
Medium Priority
?
144 Views
Last Modified: 2010-03-05
I want to receive 1 or 2 input values from internet users in order to make searches in an ascii file and i want the searching results to be aligned in the web page.
2)How this script can be executed from my page
May I have an example.
Thank you
0
Comment
Question by:vage78
1 Comment
 
LVL 3

Accepted Solution

by:
guadalupe earned 30 total points
ID: 2627837
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

</HEAD>

<BODY BGCOLOR="#FFFFFF">
<FORM METHOD=POST ACTION="/cgi-bin/script.cgi">
<INPUT TYPE="text" NAME="val1">
<INPUT TYPE="text" NAME="val2">
</FORM>
</BODY>
</HTML>



######################################
#CGI Script: script.cgi


#!/usr/local/bin/perl

&parseInput;


#Rest of code

#This will leaves all variables in a hash called %fields where the key is the
#Name of the form field and the value the value of the correspnding field.
#!!!!Be carefull with checkboxs they are only sent as form elements if they are
#checked...





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

}
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question