CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
DESPERATELY NEED A SCRIPT

 



monicawalston
Deleted

Nov 24, 2000, 6:21 AM

Post #1 of 2 (841 views)
DESPERATELY NEED A SCRIPT Can't Post

I need help finding a script. I'll try to explain the best I can. I have a form that clients fill out. It's actually a contract. It's just like an off line contract, but the parts where the user needs to fill in info, there are drop down menus and text boxes etc. What I need is when the form is submitted to me, I need it to read just like it does in the html page, just like a contract, in order, with the form fields being where they are placed in the html. Do I make sense? If anyone can help me, please e-mail me. PLEASE! If you would like to view the contract, go to http://www.walstonet.com/contract.html THANK YOU!!!


chrisabrooks
Novice

Nov 25, 2000, 3:17 AM

Post #2 of 2 (841 views)
Re: DESPERATELY NEED A SCRIPT [In reply to] Can't Post

Think this is what you are looking for:

#############################################
#!/usr/bin/perl

&GetFormInput;

$redirect = $field{redirect};
$recipient = $field{recipient};
$email = $field{email};
$Day = $field{Day};
$Month = $field{Month};
$Year = $field{Year};
$Name = $field{Name};
$Address = $field{Address};
$StartMonth = $field{StartMonth};
$StartDay = $field{StartDay};
$StartYear = $field{StartYear};
$TotalAmount = $field{TotalAmount};
$Deposit = $field{Deposit};
$Balance = $field{Balance};
$Signature = $field{Signature};
$SignatureTitle = $field{SignatureTitle};
$SignatureMonth = $field{SignatureMonth};
$SignatureDay = $field{SignatureDay};
$SignatureYear = $field{SignatureYear};

print <<END;
Content-type: text/html\n\n


INSERT HTML HERE

END
;


sub GetFormInput {

(*fval) = @_ if @_ ;

local ($buf);
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN,$buf,$ENV{'CONTENT_LENGTH'});
}
else {
$buf=$ENV{'QUERY_STRING'};
}
if ($buf eq "") {
return 0 ;
}
else {
@fval=split(/&/,$buf);
foreach $i (0 .. $#fval){
($name,$val)=split (/=/,$fval[$i],2);
$val=~tr/+/ /;
$val=~ s/%(..)/pack("c",hex($1))/ge;
$name=~tr/+/ /;
$name=~ s/%(..)/pack("c",hex($1))/ge;

if (!defined($field{$name})) {
$field{$name}=$val;
}
else {
$field{$name} .= ",$val";

#if you want multi-selects to goto into an array change to:
#$field{$name} .= "\0$val";
}


}
}
return 1;
}


#############################################
I haven't tested it, but it should work. All you need to do is to re-type the contract where I've put "Insert HTML here", and put the variables in place of the text boxes/pulldown menus. e.g:

I, $name agree to blah blah blah on the $Day's of the $Month whatever...

HTH,

------------------
My Little Webring
The Best Of All That Is British
chris.a.brooks@lycos.com
Cult Forums - Cult CGI forum

Linux - Join the revolution!!!


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives