Solved

sending results to 2 people from info on form

Posted on 1998-07-22
18
208 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
18 Comments
 
LVL 6

Accepted Solution

by:
alamo earned 80 total points
Comment Utility
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
Comment Utility
Have you considered asking about java script in the java script group?
0
 
LVL 6

Expert Comment

by:alamo
Comment Utility
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
 

Author Comment

by:craigs052998
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
   $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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 6

Expert Comment

by:alamo
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

17 Experts available now in Live!

Get 1:1 Help Now