Solved

I want to receive 1 or 2 input values

Posted on 2000-03-16
1
136 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 15 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
read PayflowPro reports using the report metadata using perl 11 36
perl CPAN issue 3 99
Using Perl DBI to query oracle 3 34
Perl script to delete older files 6 73
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now