sending results to 2 people from info on form

I have an information form at the location below.  When I submit all I get is my code on the screen.
the mods are 755 on the files and the cgi-bin directory it is stored in.  On another unix system I was getting a 500 error in the code also.  I did not do the pl code but was told it would work.  all I want the pl to do is email to the sender and a receiver the data entered on the form.  from what I can see this form does more but at this point all I really want it to do is spit out the data the user entered on the form then pressed the submit button at bottom.  if there is any easier code I am all for it.

Who is Participating?
Delete the first line of the script... it tells the system what application to run, and the comment you added keeps it from running as a script.

should be the first line, assuming that on your system that's the right path to perl.
Have you considered asking about java script in the java script group?
Also - the line

print OUT "Age and gender:              $form{'age'}"---"$form{'gender'}\n";
should be
print OUT "Age and gender:              $form{'age'} --- $form{'gender'}\n";

and the line
print OUT "Use Wooster products:        $form{'use'}\n;
should be
print OUT "Use Wooster products:        $form{'use'}\n";

Those two fixes will fix the 500 errors. I have no way to test whether the mailing part will work, that's system dependent, but you should try the command it is submitting from the command line.

Hope this helps!
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

craigs052998Author Commented:
still no good after I made the changes and I did post in the javascrip area under csindorf
I didn't have any problems with the javascript, I copied the page locally and it worked. (Or at least I got the "Thank You" page.

Is the cgi-bin directory one that has been set in the server config as as executable, or did you just create it with that name?

Is .pl mapped as an executable file type? Try renaming it to .cgi and see if that helps.
Once you get it to run, two more minor changes:
remove the \ in the line where you set $send_to
if ($ENV{'REQUEST_METHOD'} eq "get" )
if (lc($ENV{'REQUEST_METHOD'}) eq "get" )

And the email command it tries to run is:
/bin/mail escl -t emailaddress -s Visitor_center -q
   $year = '0' . $year if length($year) < 2;
    $century = "19";
    return ("$day, $month $mday $century$year");
Please don't do this.  It's very late to be creating Y2K bugs.
it should be
    $year += 1900;
    return ("$day, $month $mday $year");
craigs052998Author Commented:
What do you mean by the Thank You page?  The one that would have said  thank you your feedback is appreciated?  did you actually get the output to your screen?  can you copy the pl to your system and change it so you can get an e-mail verification?

yes it has on the server.  I saw others with accounts on the same server with that same dir in their folder. so I created it with 755 in mine also

and renaming it did not help

I also posted it in javascript under csindorf if you would take a look there.
craigs052998Author Commented:
if there is any shorter code to do this I am game for it?  I do not need the date returned just the data from the questionaire in the form of question then the answer beside it and that to be sent to a user to read and a copy sent to the sender as well..
By the thank you page, I mean the page that says
Thank you Your feedback is appreciated. Please use the toolbar on the right for your next selection
after you submit. I got this from MY system, after copying the script here.

So the problem is your setup. I think - not certain, never set up Apache -  you can't just create a cgi-bin and have Apache recognize it as an executable directory, you have to configure Apache to know that your specific directory is executable. (Maybe ny creating a link from Apache's main CGI dir?) The other possible problem is that your directory itself (not just the files in it) needs to be 777 if I remember correctly. (The 777 instead of 755 is so that your script can create the temp file).

btw, ozo - right now a year 2000 problem would be quite welcome, compared to the current year 1998 problem :-)
craigs, the script isn't masterfully written, but all the problems you are having getting it to work you would have to face with a changed script, plus possibly more. I'd advise you to get this one at least running first.
craigs052998Author Commented:
could this be done without the .cgi or .pl ?  ie Just do it in the javascript portion of the page?  If so answer it in the javascript area under a question by csindorf
By the way, I personally prefer this script approach to a mailto, when I come across a mailto in a form I just go to another site. My email is completely separate from my browser, mailtos don't work at all. i prefer not to have to upgrade my email whenever I upgrade my browser and vice versa. I realize though that most people don't bother to do this.

And I am pretty sure two mailtos in a form are impossible, in part because javascript can't do mailtos.
I hadn't seen your last comment, but I pretty much answered it. If you want a singel email you can do it in a form, no javascript needed. Two aren't possible even with javascript.
I did some checking into Apache, and it all depends on how your system config is set up., but most likely the problem is that you need a "ScriptHandler" directive telling the server that your cgi-bin directory is allowed to run scripts.

Based on what we are seeing, I am pretty certain the server config is the problem. If you get the administrator to fix it up the script should run.

I have to go now, until tomorrow.
I checked that script too and there was no any error messages,
browser just opened script as a txt file. Why same script working
on Alamo's machine and not in Craigs's place - I think, just
because Craigs's server is not recegnizing script as executable.
 " I created it with 755 in mine also.." Just by creating folder
with this name and changing permission will do nothing.
If you're using a typical UNIX server, you can try this. Simply
create a text file called .htaccess in the same directory as your
web pages. Put there just one line:

AddType application/x-httpd-cgi .cgi

Additional you may want to add a Type for perl scripts:
AddType application/x-httpd-cgi .pl

This adds CGI Script files and their MIME type to the server's configuration for this directory. If you already have a .htaccess
file, add this line(s) to the existing file. That's all.

Please note: These instructions may differ for your server. If the above does not work, or if you are unable to create the .htaccess file, contact your system administrator; they should be able to add the MIME type
for you (that's the more proper way). Tell them the extension is .cgi and the MIME type is "application/x-httpd-cgi .cgi", or just you want run CGI scripts. ..Of course if running CGI scripts is a part of your user plan.

Regards, Happy®One
P.S. Alamo, isn't permission 777 ("world writable") - too
dangerous for CGI-BIN folder?

Yes, HappyOne, 777 probably is dangerousfor CGI-BIN. And now I think of it, as long as the file already exists or is created in a different directory, the directory should be Ok with 755. craigs will have to create the file in order to get the script to work.

craigs, I noticed you accepted the answer to this question in CGI that described how to configure the server. (Though it didn't look Apache-specific to me). But you script still doeesn't work.
craigs052998Author Commented:
I sent it up to the server that it will actually be stored on and I got just the script returned to the screen not actually running it.  So I found another less buggy one and got it to work and it works like a champ.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.