villa has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to create a .pl script that processes data via "GET" from a HTML form and appends the info to a seperate .html file.The contents I need to append is the result I get on the URL command line after submitting 3 data field entrys;ie URL command line example:
http://firm.com/cgi-bin/inter.pl?candidate=Juan+Amore&position=Technic +ian&education=Professional+Certification&RESULT_FileUpload-7=&RESULT_ +TextArea-8=&Submit=Submit
My perl code is the following which is what I'm trying to use to clean up the + and & signs which are associated on the above URL command submission and trying to clean it up a bit and have it displayed via a HTML format
</CODE>Below is my HTML form which I'm using to create a CGI script for it to send that URL command line data to STDOUT via a HTML file. Is there also a way of letting a user know via a HTML Notice of confirmation if all three field areas;ie candidate,position & education have been entered and if one is left blank to respond back and tell user that theres an error,...please fill in field. Any HELP is MOST Appreciated!!:)#!/usr/bin/perl -w # Copy form data from the environment variable $form_data = $ENV{'QUERY_STRING'}; $form_data =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C",hex ($1))/eg; # Replace the + char with space char. $form_data =~ s/\+/ /g; # Split $form_data into name/value pairs @fields = split (/&/, $form_data); # Init script variables with form data values # $form_name is the name from the form. # from the text fields... ($form_name, $candidate) = split (/=/, $fields[0]); ($form_name, $position) = split (/=/, $fields[1]); ($form_name, $education) = split (/=/, $fields[2]); $form_name > dataform.html # Send back to the user a confirmation. print << "END_OF_REPLY"; <Content-type: text/html> END_OF_REPLY <HTML> <HEAD> <TITLE>Confirmation Mesg</TITLE> </HEAD> <BODY> <P><FONT SIZE=5>Thanks $first! We'll send you your: $status.</FONT></P> </BODY> </HTML> END_OF_REPLY
<HTML> <FORM ACTION="/cgi-bin/inter.pl" METHOD="GET"> <B>Candiate Name</B> <INPUT TYPE="TEXT" NAME="candidate" SIZE="25" MAXLENGTH="25"> <B>Position Applied For</B> <INPUT TYPE="TEXT" NAME="position" SIZE="25" MAXLENGTH="25"> <B>Education Level</B> <!--DROP_DOWN_TYPE --><SELECT NAME="education"> <OPTION></OPTION> <!--DROP_DOWN_TYPE NAME="education" VALUE="Radio-0" --><OPTION> High S +chool</OPTION> <!--DROP_DOWN_TYPE NAME="education" VALUE="Radio-1" --><OPTION> Vocati +onal Degree</OPTION> <!--DROP_DOWN_TYPE NAME="education" VALUE="Radio-2" --><OPTION> Associ +ates Degree</OPTION> <!--DROP_DOWN_TYPE NAME="education" VALUE="Radio-3" --><OPTION> Bachel +ors Degree</OPTION> <!--DROP_DOWN_TYPE NAME="education" VALUE="Radio-4" --><OPTION> Master +s Degree</OPTION> <!--DROP_DOWN_TYPE NAME="education" VALUE="Radio-5" --><OPTION> Doctor +al Degree</OPTION> <!--DROP_DOWN_TYPE NAME="education" VALUE="Radio-6" --><OPTION> Post-D +octoral Studies</OPTION> <!--DROP_DOWN_TYPE NAME="education" VALUE="Radio-7" --><OPTION> Profes +sional Certification</OPTION> </SELECT>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to write a CGI script for this piece of HTML
by IlyaM (Parson) on Nov 27, 2001 at 07:13 UTC | |
by villa (Initiate) on Nov 28, 2001 at 22:12 UTC | |
by IlyaM (Parson) on Nov 28, 2001 at 22:31 UTC | |
|
Re: Trying to write a CGI script for this piece of HTML
by Dogma (Pilgrim) on Nov 27, 2001 at 07:25 UTC | |
by chromatic (Archbishop) on Nov 27, 2001 at 08:50 UTC |