Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

I want to receive 1 or 2 input values

Posted on 2000-03-16
1
Medium Priority
?
143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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

705 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