Solved

Too much stuff on form results.

Posted on 1997-11-06
3
199 Views
Last Modified: 2013-12-25
I'm using FP98 and I have a problem with form results.....
I have a site with multiple "dropdown menus" with options 0-4.(0 is default)
I have about 100 of those dropdown  menus on single form.
When I get form results I will gett every single option listed on form
results and would like to get only options that are selected 1 or higher on
my results so I would not get this huge list of info that I dont really
need. Form results would be E-mailed to my customers.
How would I need to do this?
I dont know how to program with Perl so I am unable to create my own CGI
scripts, but I would imagine it should be pretty simple script.
Any help is appreciated.
Thanks Ossi hoster19@idt.net
0
Comment
Question by:hoster19
3 Comments
 
LVL 5

Expert Comment

by:julio011597
ID: 1831104
This is Javascript work, i'm afraid.

-julio
0
 

Accepted Solution

by:
p_reynolds earned 100 total points
ID: 1831105
Try this. Be sure to make it executable by typing "chmod 755 thisscript.cgi" on the UNIX command line. "thisscript" of course being whatever you call this script. Make it a plain ASCII file and save it to your cgi-bin. It's hard to write a script if I don't know: Email addresses, purpose of the form, data to be sent. This is a nice basic email form. It will parse the data from the form, test the value of each and place values greater than 0 into a single variable that will be emailed to the designated address. I hope this is a good start anyway. The best thing you could ever do if you administer a website is to learn PERL. Look at this script and figure out what's going on. Hope this helps/works!

#!/usr/bin/perl

$email = "email\@email.com";
$replyto = "replyto\@email.com";
$subject = "Automatic Email";

# Read in form data
read(STDIN,$buffer,$ENV{CONTENT_LENGTH});
# Split to name=value pairs
@pairs = split(/=/,$pair,2);
foreach $pair (@pairs) {
      ($name,$value) = split(/=/,$pair,2);
      $value =~ tr/+/ /;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1)/eg;
      $FORM{$name} = $value;
}
#Now access form data as $FORM{name} (i.e. $FORM{pulldown2})

# Test the value and save the ones greater than 0 into $sendThis
foreach $pair (sort keys %FORM) {
      if $pair > 0 {
            $sendThis .= "$FORM{$pair}\n";
      }
}


open(MAIL,"| /usr/lib/sendmail $email") || die "Can't open mail!"
print MAIL "Reply-to: $replyto\n";
print MAIL "Subject: $subject\n";
print MAIL "$sendThis\n\n";
close(MAIL);

exit(0);
0
 

Author Comment

by:hoster19
ID: 1831106
P Reynolds please E-mail me at hoster19@idt.net

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

758 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

20 Experts available now in Live!

Get 1:1 Help Now