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

x
?
Solved

Form processing.

Posted on 2000-05-10
5
Medium Priority
?
156 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 200 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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

721 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