Solved

sending results to 2 people from info on form

Posted on 1998-07-22
18
222 Views
Last Modified: 2010-03-05
I have an information form at the location below.  When I submit all I get is my visitor.pl 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.

TIA

http://gomer.kent.edu/~csindorf/cgi-bin/guestbook.html
0
Comment
Question by:craigs052998
[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
18 Comments
 
LVL 6

Accepted Solution

by:
alamo earned 80 total points
ID: 1208633
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.

#!/usr/bin/perl
should be the first line, assuming that on your system that's the right path to perl.
0
 
LVL 5

Expert Comment

by:b2pi
ID: 1208634
Have you considered asking about java script in the java script group?
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208635
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!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:craigs052998
ID: 1208636
still no good after I made the changes and I did post in the javascrip area under csindorf
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208637
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.
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208638
Once you get it to run, two more minor changes:
remove the \ in the line where you set $send_to
and
if ($ENV{'REQUEST_METHOD'} eq "get" )
becomes
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
0
 
LVL 84

Expert Comment

by:ozo
ID: 1208639
   $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");
0
 

Author Comment

by:craigs052998
ID: 1208640
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.
0
 

Author Comment

by:craigs052998
ID: 1208641
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..
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208642
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 :-)
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208643
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.
0
 

Author Comment

by:craigs052998
ID: 1208644
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
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208645
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.
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208646
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.
0
 
LVL 6

Expert Comment

by:alamo
ID: 1208647
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.
0
 
LVL 2

Expert Comment

by:happy1
ID: 1208648
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.
 
 "..so 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?

0
 
LVL 6

Expert Comment

by:alamo
ID: 1208649
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.
???
0
 

Author Comment

by:craigs052998
ID: 1208650
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.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

695 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