Solved

Form processing.

Posted on 2000-05-10
5
154 Views
Last Modified: 2013-12-25
I've got a homepage where users can fill in 2 forms. How can I process the data that the user filled in at these forms. (The forms are created by html code). I know how to program in cgi, but I don't know how I can extract the form-data if the cgi-script has been called. Hope someone can help me out...
0
Comment
Question by:oostwijk
[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
5 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 2797468
here is a simple solution using PERL and CGI.

==========form1.html
<form method=post action=/cgi-bin/form1.pl>
<input type=text name=name><BR>
<select name=type>
<option value=".123">123
<option value=".345">345
<option value=".075">075
</select>
<P>
<input type=submit>
</form>


==========form1.pl
#!/usr/local/bin/perl

use CGI;

$q=new CGI;

##  Read the users input values.
$name=$q->param('name');
$type=$q->param('type');

print "Content-type: text/html\n\n";

print qq {
  <B>You selected.... </B><P>
  Name: $name<BR>
  Type: $type<BR>
  <HR>
};


hope that helps
0
 

Accepted Solution

by:
noleaders earned 50 total points
ID: 2809353


   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
   if (length($buffer) < 5) {
         $buffer = $ENV{QUERY_STRING};
    }
 
  @pairs = split(/&/, $buffer);
   foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);

      $value =~ tr/+/ /;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

      $FORM{$name} = $value;
   }

$action = $FORM{'action'};

This parses the input of any value of your form... If your form field name is called: Question1 the variable to call the data inputed to that field is:

$FORM{'Question1'}

Hope that does it!
0
 

Expert Comment

by:kurman
ID: 2809622
use wwwlib.pl
this gives you simplified access to both POST and query.
Only things you need to specify is the input- and the text or option
button names etc.
0
 
LVL 7

Expert Comment

by:ssdesign
ID: 2810677
go to

http://cgi.resourceindex.com/Programs_and_Scripts/Perl

You will find lots of scripts that will do the job for you.
0
 

Author Comment

by:oostwijk
ID: 2818488
That does the job...
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Some AHK commands fail in Microsoft OneNote 5 87
Powercli + List all VM's Per SCSILUN 15 138
Help to debug powershell script 5 58
Powershell PGP and SFTP 1 49
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

710 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