The difference is (at least for me): I know sendmail, but I don't know formmail ;-) Sorry I can't help you with that.

> 2.Can I use any email through Sendmail? E.g. hotmail accounts?

I don't know exactly what you mean here, but if your point is whether you can send mail to any accounts, the answer is yes.

> Set the file permissions on the cgi script file and directories to be 'chmod 755'. > 3.What does this mean? How can I do this? > I read it has something to do with FTP. I use WSFTP.

It's not so much about FTP. Apache at netfirms is configured to accept only files with certain permissions. But you can use your FTP client to set the permissions using the chmod command. I've been working with WSFTP some years ago until I discovered LeechFTP, which I find much easier to use. If you like to try it, it's free. Using LeechFTP, you can send a chmod command by right clicking on a remote file and selecting 'Set Attributes...'. 755 is Read and Execute for everyone and Write only for Owner.

> 4.Would it be better to have my Form call my .cgi program to send me the mail?

Yes, I think so. You should place the form in your HTML file and use the cgi script only for sending the mail. CGI-only sites are only useful if most of the content is dynamic. If there's lots of static stuff, you should separate HTML and CGI. I've written a CGI-only website. It's a small search engine for my DVD collection. And it's in german ;-) There's not a single HTML file, only two CGI scripts managing the whole site. (Plus an admin & statistics script, but these are only for me.)

I ONLY adjusted the settable variables, the shebang line and the line under it. Line under shebang line

Code

use CGI::Carp qw(fatalsToBrowser);

I can’t get my Form to work. I always receive this error…

In Reply To

Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, Your Webmaster and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.

I know I have the location of perl and sendmail correct. I’ve also set my .cgi file permissions to 755.

2. Am I suppose to do anything with either of the following?

In Reply To

CGI Urlhttp://domain.netfirms.com/cgi-bin/file.cgi

Your full or absolute root path is:$ENV{'DOCUMENT_ROOT'}

Remember to use double quotes around the path. The full path to your www directory would be: "$ENV{'DOCUMENT_ROOT'}/www" The full path to your cgi-bin directory would be: "$ENV{'DOCUMENT_ROOT'}/cgi-bin"

Should I be looking at this file for anything…

http://jennyw.netfirms.com/cgi/printenv

3. My .cgi file used to be a .pl file, but I just saved it as a .cgi document? Is that ok?

Some similar questions…

Using netfirms.com 4. If I have html documents that call on .cgi docs then what folder do I put my pages in? Do I put them all in the same folder? Or do html docs go in the /www folder and .cgi docs in the /cgi-bin ?

5.

In Reply To

You wrote… I've written a CGI-only website. It's a small search engine for my DVD collection. And it's in german ;-) There's not a single HTML file, only two CGI scripts managing the whole site. (Plus an admin & statistics script, but these are only for me.)

How do YOU upload your .cgi scripts to netfirms.com?

In Reply To

Netfirms.com writes…

You must place all your html and image files in the 'www' directory. Only files placed in the 'www' directory can be viewed on your website. Keep all filenames in lowercase characters.

I tried uploading the .cgi email catching script you gave me to netfirms, but it didn’t work. The page wouldn’t come up when I called it in the browser.

I've written this offline and it took a while. I wouldn't want to delete the already answered questions... ;-)

> I had a lot of login problems with Leetch. Basically, it wouldn’t let me login to certain ftp clients once in a while.

Interesting... I'm using it for years now, and I didn't have any problems. Anyway, I think you'll be happy with WSFTP, too.

> I can’t get my Form to work. I always receive this error

First, the modifications to your file were (mostly) correct (see below). This error mostly shows when there's a problem with the file rather than with the source code. There were two problems: First, you have to convert all your CGI-scripts to Unix format. The file you linked to was in DOS format, meaning each line was terminated by a CR/LF sequence, while lines in Unix files are only terminated with a LF character. To do this conversion, you can use a good text editor (e.g. UltraEdit, use File / Convert / DOS to Unix) or the following script:

Provide it with the name of the file you'd like to convert as the first parameter. The second problem I discovered is that CGI files at netfirms need to be mode 700 instead of mode 755. By the time I registered at netfirms, they also wrote 700 on their page. Perhaps they're making a transition here and it'll work with 755, but if you change to 700 I think you're safe.

> Am I suppose to do anything with either of the following?

No, not really. You should keep in mind that when you reference from HTML to CGI you must use cgi-bin/file.cgi instead of plain file.cgi and when you reference from CGI to HTML, you must use ../file.html instead of plain file.html. So, in your script you should rather write

Code

$ErrorPage = "../a_fail.html";

instead of

Code

$ErrorPage = "a_fail.html";

if a_fail.html is in your www directory.

> http://jennyw.netfirms.com/cgi/printenv

Are you sure with this url? Shouldn't that be http://jennyw.netfirms.com/cgi-bin/printenv.cgi?

> 3. My .cgi file used to be a .pl file, but I just saved it as a .cgi document? Is that ok?

Absolutely.

> 4. If I have html documents that call on .cgi docs then what folder do I put my pages in? > Do I put them all in the same folder? Or do html docs go in the /www folder and .cgi docs in the /cgi-bin ?

Separate them. The cgi-bin is for CGI scripts, logs, data accessed by CGI scripts, Perl libraries, etc. The www is for all your HTML, CSS, pictures, files that can be downloaded.

> How do YOU upload your .cgi scripts to netfirms.com?

Actually, I've written a tricky upload script in Perl. That's because first, the site has lots of images, and I don't want to keep track of which of them I have updated locally, and second, I can't (and don't want to) remember when I locally modify my scripts. Well, my upload script first connects to the netfirms server, recursively retrieves a list of all files on the server, retrieves such a list of the local files on my machine, and checks which files are different. If files differ, it is assumed that the local files are up-to-date. These files are uploaded. If files are available locally, but not on the server, these are uploaded, too. If files are available on the server, but missing locally, these files are removed from the server. The script also converts all my CGI scripts before uploading so they will have the right shebang line. And last but not least the script sends a chmod 700 for every uploaded CGI script. Using this script saves me from worrying about synchronization of local and remote files and also saves my money because it significantly reduces my internet costs ;-) If you're interested in the script, tell me. But be aware that you surely will have to modify it before you can use it. As I said it's a quite tricky sort of script.

> I tried uploading the .cgi email catching script you gave me to netfirms, but it didn’t work. The page wouldn’t come up when I called it in the browser.

Well, I also tried it and it showed up. I don't know if it actually works, but at least it showed up. Are you sure it hasn't got something to do with Unix format or mode 700?

> But some of the files have a slash ( / ) in front of the file name, so should I have a slash before the file name?

Normally files don't have slashes in front of their names ;-) The slash only indicates that the file is located in the root directory. I don't believe this is correct. But, as I mentioned above, you should reference the file from the CGI script as if it was located in the parent directory (../).

Bye, Marcus

P.S.: There's a successor to LeechFTP, called BitBeamer (ftp://ftp.cuhk.edu.hk/.1/chinese/cpatch/ftp/bitbeamer/bitbeamer2001.exe), which has a synchronize option. This should be quite similar to my upload script, except for modifying scripts and the chmod. It's still in beta state, and I haven't tested it. Since I don't know if WSFTP has a synchronize option, perhaps this is interesting for you.

Hiee Marcus. Thanks so much for the giant reply. I can’t begin to explain how much you’re helping me out!

Ok, before I start asking more questions I made a few changes to my .cgi script. Now, I’m getting my “a_fail.html” page.

I changed the following parameters on my .cgi script. They were asking for url’s, not file paths. # URL to go to if there is a problem with form input $ErrorPage = "http://jennyw.netfirms.com/a_fail.html";

# URL to go to when form has been successfully submitted $ThankPage = "http://jennyw.netfirms.com/a_thanks.html";

# URL to go to if a 'foreign' referer calls the script $EvilReferer = "http://jennyw.netfirms.com/a_fail.html";

You wrote…This error mostly shows when there's a problem with the file rather than with the source code. There were two problems: First, you have to convert all your CGI-scripts to Unix format. The file you linked to was in DOS format, meaning each line was terminated by a CR/LF sequence, while lines in Unix files are only terminated with a LF character.

How can you tell that my .cgi doc was in DOS format? What did you see?

To do this conversion, you can use a good text editor (e.g. UltraEdit, use File / Convert / DOS to Unix) or the following script:

I can’t use Notepad or Wordpad? If so, why not? Is UltraEdit free? I’d be looking for a free program if the above two can’t be used.

In regards to the script aboveWhere would I place it? Is it a separate file or does it go within the .cgi script that needs changing? Would I use this for all DOS to Unix .cgi script conversions?

I was told that all of my .cgi scripts need to be uploaded in 'ASCII' format? Is this correct? In WSFTP there are three options: ASCII - Binary - Auto

What is Auto?

Ohh boy here I go again, I didn’t want to ask this many questions.

In Reply To

You wrote… The second problem I discovered is that CGI files at netfirms need to be mode 700 instead of mode 755. By the time I registered at netfirms, they also wrote 700 on their page. Perhaps they're making a transition here and it'll work with 755, but if you change to 700 I think you're safe.

> I changed the following parameters on my .cgi script. They were asking for url’s, not file paths. > # URL to go to if there is a problem with form input > $ErrorPage = "http://jennyw.netfirms.com/a_fail.html";

Have you tried if it works with

Code

$ErrorPage = "../a_fail.html";

If it does, it's easier to reuse if you change your server.

> How can you tell that my .cgi doc was in DOS format? What did you see?

Magic ;-) No, not really, both editors I'm using (Vim and UltraEdit) display the file format, which they determine from the line terminator sequence.

> I can’t use Notepad or Wordpad? If so, why not? > Is UltraEdit free? I’d be looking for a free program if the above two can’t be used. > In regards to the script above > Where would I place it? Is it a separate file or does it go within the .cgi script that needs changing? > Would I use this for all DOS to Unix .cgi script conversions? > I was told that all of my .cgi scripts need to be uploaded in 'ASCII' format? Is this correct? > In WSFTP there are three options: ASCII - Binary - Auto

I'll answer all this in a single paragraph :-) First, you can use any editor you want if you transfer your scripts in ASCII mode. Even if the editor generates DOS format, uploading as ASCII will automatically convert to the format needed by the server (which is Unix format for netfirms.com). I could have given you the hint with the ASCII format, but I so rarely use it, I just forgot about it. I always transfer all my files in binary mode, so my editors both save files in Unix format. The advantage is: Unix format files will run under Windows, but DOS format won't work under Unix. The difference between ASCII, binary and Auto can only be noticed if a Windows machine and a Unix machine are doing FTP, since they have different text format (didn't I mention this already??). In binary mode, a file is always transferred 'as is', i.e. no single byte is changed. In ASCII mode, line terminators are changed to fit for the system a file is up- or downloaded to. Perhaps also other character conversion is done. In Auto mode, the FTP-Client tries to automatically determine if a file should be transferred in ASCII or binary mode. I'm not sure which it chooses when, because I always use binary transfer. Concerning the Editor choice, UltraEdit is not free, but IMO the second-best Windows editor and worth its money. The best editor is Vim, although many none-hardcore-programmers may not agree with me. It's the best because it's free, has simply the best syntax highlighting features (you should see Perl code with Vim!!), and is so incredibly fast to use if you work with it often enough. Unfortunately it's no fun to learn working with Vim if you only know Word or Notepad... Concerning my script: Either forget about it (use ASCII mode) or place it anywhere on your local machine. Don't upload it, it's useless on the server. Open a command prompt, change to the directory where the script is in, and enter something like this (if you name the script dos2ux and you want to convert the cgi-file test.cgi:

Code

perl dos2ux test.cgi

The script will create a backup of the cgi-file called test.cgi.bak and the test.cgi will afterwards be in Unix format.

Now, it should be clear that mode 700 grants all right to the user and denies permission for everyone else to do anything with the file. If you would set mode 000, even the user has no permissions, but the user (and only the user) can always change the file mode.

> Yes, I am positive! Check out the url!

Ok, that was my fault. I thought the printenv script was one you've written, but it's a netfirms script that works for all accounts. I've written the printenv script on my own, so I was a bit mislead here...

> Well, I also tried it and it showed up. I don't know if it actually works, but at least it showed up. Are you sure it hasn't got something to do with Unix format or mode 700? > I’ll wait ‘till I get responses from previous questions before I tackle this bugger again!

I just put the file into my cgi-bin directory. Test it, if you like, it's here.

> Your upload script sounds very complicated. I think I’ll stick with the basics. It’s a little over my head!

First, you can use any editor you want if you transfer your scripts in ASCII mode. Even if the editor generates DOS format, uploading as ASCII will automatically convert to the format needed by the server (which is Unix format for netfirms.com). I could have given you the hint with the ASCII format, but I so rarely use it, I just forgot about it. I always transfer all my files in binary mode, so my editors both save files in Unix format. The advantage is: Unix format files will run under Windows, but DOS format won't work under Unix.

Ok, so what you’re saying is I don’t have to worry about text editors, as long as I upload my .cgi scripts in ASCII format then I’m ok?

The thing is I’ve uploaded my .cgi script to netfirms.com as ASCII format and I got the “a_fail.html” (error) page. However, I set my cgi-bin and .cgi scripts to chmod 755.

Do I have to set all my .cgi scripts to chmod 700? Do I set my .cgi-bin to chmod 700 too?

In Reply To

You also wrote

Concerning my script: Either forget about it (use ASCII mode) or place it anywhere on your local machine. Don't upload it, it's useless on the server. Open a command prompt, change to the directory where the script is in, and enter something like this (if you name the script dos2ux and you want to convert the cgi-file test.cgi: perl dos2ux test.cgi The script will create a backup of the cgi-file called test.cgi.bak and the test.cgi will afterwards be in Unix format.

So if I do this at the command prompt then I won’t need to upload in ASCII, I can upload in binary insetad?

Ok, that was my fault. I thought the printenv script was one you've written, but it's a netfirms script that works for all accounts. I've written the printenv script on my own, so I was a bit mislead here...

What should I do with the url above? What is its function?

In Reply To

You wrote…Well, I also tried it and it showed up. I don't know if it actually works, but at least it showed up. Are you sure it hasn't got something to do with Unix format or mode 700? > I’ll wait ‘till I get responses from previous questions before I tackle this bugger again!

I just put the file into my cgi-bin directory. Test it, if you like, it's here.

I noticed your script has a .cgi extension.

I read this in netfirms…

You must place all your html and image files in the 'www' directory. Only files placed in the 'www' directory can be viewed on your website. Keep all filenames in lowercase characters. Your main page should be called index.html or index.htm.The webserver first looks for index.html and if not there it looks for index.htm

Why does netfirms.com write…

Only files placed in the 'www' directory can be viewed on your website.

If only files placed in the www directory can be viewed then how are YOU able to put .cgi scripts in the cgi-bin and view them (below)?

> Ok, so what you’re saying is I don’t have to worry about text editors, as long as I upload my .cgi scripts in ASCII format then I’m ok?

That's right!

> The thing is I’ve uploaded my .cgi script to netfirms.com as ASCII format and I got the a_fail.html” (error) page. However, I set my cgi-bin and .cgi scripts to chmod 755.

That's perfect, because it shows your cgi-script is actually running. If it wouldn't be running, you'd get a Server Error instead of your a_fail.html. It's not so perfect because it shows that something else is wrong... Also, you don't have to chmod your files to 700, as they seem to work with 755.

> Do I set my .cgi-bin to chmod 700 too?

You shouldn't change the mode of your cgi-bin directory.

> So if I do this at the command prompt then I won’t need to upload in ASCII, I can upload in binary insetad?

That's right. But beware that when you're using Notepad, you won't be able to view the converted files correctly. So I really recommend to use either ASCII upload or get a text editor supporting Unix file format.

> What should I do with the url above? What is its function?

Did you run the script? It shows which environment variables are set by the Apache server. You can access the environment variables in Perl using the %ENV hash table. But in most cases, this is not really needed. On my page, I only use it to display the Apache version.

> I noticed your script has a .cgi extension.

Well, yes. Just to show it's a CGI script...

> Only files placed in the 'www' directory can be viewed on your website. > If only files placed in the www directory can be viewed then how are YOU able to put .cgi scripts in the cgi-bin and view them (below)? > http://mhx.netfirms.com/cgi-bin/emtest.cgi

That's because you cannot view a CGI script. You can only view its output. Whatever you print in your CGI script will be used to generate a temporary HTML file that is displayed by the webserver. This temporary file is nowhere but in the server's memory. It's quite ok that your cannot view anything in the cgi-bin directory. If you could, everyone could steal your CGI scripts, or Amazon's, or IBM's, or ...

We wrote…> The thing is I’ve uploaded my .cgi script to netfirms.com as ASCII format and I got the a_fail.html” (error) page. However, I set my cgi-bin and .cgi scripts to chmod 755.

That's perfect, because it shows your cgi-script is actually running. If it wouldn't be running, you'd get a Server Error instead of your a_fail.html. It's not so perfect because it shows that something else is wrong... Also, you don't have to chmod your files to 700, as they seem to work with 755.

> Do I set my .cgi-bin to chmod 700 too?

You shouldn't change the mode of your cgi-bin directory.

I DID change the mode of my actual cgi-bin to 755. Why is this wrong? Should I only be setting the mode for the .cgi scripts?

Should I take this line out of the .cgi script?

Code

use CGI::Carp qw(fatalsToBrowser);

The above is right under the Shebang line.

I only adjusted to the shebang line, set the variables (at beginning of doc) and I added the line listed above.

Maybe it’s my email variables? The script directed me to do the following…

Did you run the script? It shows which environment variables are set by the Apache server. You can access the environment variables in Perl using the %ENV hash table. But in most cases, this is not really needed. On my page, I only use it to display the Apache version.

I didn’t run the script. I know you said it’s not really important, but I’m curious - how would I be able to run the script?

In Reply To

We wrote…> I noticed your script has a .cgi extension.

Well, yes. Just to show it's a CGI script...

> Only files placed in the 'www' directory can be viewed on your website. > If only files placed in the www directory can be viewed then how are YOU able to put .cgi scripts in the cgi-bin and view them (below)? > http://mhx.netfirms.com/cgi-bin/emtest.cgi

That's because you cannot view a CGI script. You can only view its output. Whatever you print in your CGI script will be used to generate a temporary HTML file that is displayed by the webserver. This temporary file is nowhere but in the server's memory.

> I DID change the mode of my actual cgi-bin to 755. Why is this wrong?

I didn't say it's wrong, I just meant it could be better to leave it the way it was. It guess netfirms people know why they give a certain directory certain permissions.

> Should I only be setting the mode for the .cgi scripts?

Yes.

> Should I take this line out of the .cgi script? > use CGI::Carp qw(fatalsToBrowser);

No. Better leave it in, because it may issue useful information if there's something wrong with your script. You can take it out if the script works fine, but you can also leave it in.

> Maybe it’s my email variables? The script directed me to do the following… > # E-mail address to send intake form to (your address) > # If not using PERL 5, escape the @ thus: \@ instead of @ > $YourEmail = 'themustache@hotmail.com'; > I have Perl 5.004_02 so I didn’t use the \@. That’s right isn’t it?

Yes, that's right if you only use single quotes (is this ' called single quote in english?). If you use double quotes (") you must put a backslash in front of the @.

> I didn’t run the script. I know you said it’s not really important, but I’m curious - how would I be able to run the script?

I've modified your script a bit, so if you could tell me what exactly the output is if you run the script now, I'll perhaps be able to tell you what's wrong. Instead of leading you to your a_fail.html page, it will now display an error describing why it failed. I've attached the modfied file here.

I've modified your script a bit, so if you could tell me what exactly the output is if you run the script now, I'll perhaps be able to tell you what's wrong. Instead of leading you to your a_fail.html page, it will now display an error describing why it failed. I've attached the modfied file here.

Thanks for the adjustments Marcus! I’m unable to run the script now, but I’ll get to it very soon and let you know the results!

Out of curiosity what changes did you make to the script?The only script adjustments I noticed were the following lines…

>> is this ' called single quote in english? > Yes it is! Wowee, I actually answered a question! lol!

Thanks, I really wasn't sure about it...

>Out of curiosity what changes did you make to the script?

Oh, it's more than you've noticed. I mainly changed the redirection thing at the bottom of the file. Look for a line

Code

=for nobody

That's where I commented out the original code. Below is my replacement code. You'll see that I have just given the error function a string parameter which I use to give an error explanation. Instead of redirection, this explanation is printed out as HTML. Simply scroll to the end of the script and you'll see the changes.

> I changed the following parameters on my .cgi script. They were asking for url’s, not file paths. > # URL to go to if there is a problem with form input > $ErrorPage = "http://jennyw.netfirms.com/a_fail.html";

Have you tried if it works with $ErrorPage = "../a_fail.html"; If it does, it's easier to reuse if you change your server

> Does the problem have anything to do with my <html> Form code (below)?

Without looking any further at the cgi script, seeing the error it suddenly came to my mind: Do we feed the right stuff into the cgi script? No, we don't! Yes, it has to do with your HTML code. What's just missing is the text fields for Name, Email and Message. Because the email address is checked first, the script stops immediately as it doesn't discover an @ sign, because there simply is no Email field in your form. I'm going to modify your form, so it will fit for your script. But first of all, the other things:

> 'themustache\@hotmail.com'

This is definitely wrong. Keep it without the backslash. The script doesn't mean your address, but the address of the person using the form.

> So I changed the path in .cgi script from http://jennyw.netfirms.com/a_fail.html to > /a_fail.html > Is this correct? My settings are presently using this path.

No, as I said, you must change it to

Code

../a_fail.html

The two dots are absolutely neccessary.

> I also tried > /cgi-bin/fail.html > This path didn’t work on the original script (WITHOUT your modifications), but it worked on the script WITH your modifications. Why is this happening?

The path is wrong. So the original script fails. My modified script works because I took all the a_fail.html stuff out .

> Also, thanks for upload script. I’m not sure that I’ll be able to use it or if it suits my needs, but thanks!

I guess, if you're a bit more into Perl, you'll be able to use it.

But now for your HTML file modifications, here comes the step-by-step guide to success! First, use the old cgi-script. My script with the modifications was good enough for showing me the problem, but unfortunately it fails always. (I also know why! ) Be sure you have all variables set correctly, such as the fail and thanks page. Now, upload the following HTML code and try it. Be sure to enter something in all three fields, and be sure to give it a valid email address.

I even tried inserting the url’s for the “thanks”, “fail” and “EvilReferer” pages in the .cgi script, but I was still received the FAIL page.

In Reply To

What's just missing is the text fields for Name, Email and Message. Because the email address is checked first, the script stops immediately as it doesn't discover an @ sign, because there simply is no Email field in your form… …Now, upload the following HTML code and try it. Be sure to enter something in all three fields, and be sure to give it a valid email address.

well, before I start answering your questions: IT WORKS! I've just uploaded my modified HTML page, three dummy pages (a_fail.html, a_evil.html, a_thanks.html). The only changes I've made had to do with uploading and testing. I've replaced your email with mine (I can't check yours...), I've added my host to the list of referers, I've added the evil referer page and I renamed the script to alphamail.cgi. If you like, you can test it. Enter your own email address in the form and you should receive a reply immediately. I've sent a mail to myself, and received the mail as well as the reply.

> CGI script I made the adjustments below > ../a_fail.html > ../a_thanks.html > I even tried inserting the url’s for the thanks, fail and EvilReferer pages in the .cgi script, but I was still received the FAIL page.

Again, if you receive the fail page, your script works and fails not because these URLs are wrong.

> What did I do wrong?

Your HTML page couldn't work, because it's simply not what I have sent to you. You changed the names of the form elements, and so the script doesn't find these elements. You've used EnterName instead of Name, themustache@hotmail.com instead of Email and TypeYourMessage instead of Message. I guess that's all that went wrong. You could do me a favor and answer another question: Why did you change nearly the only thing that could make it all fail before testing with what I've sent you?

> Can I put spaces in the name fields above?

**NO** YOU MAY NOT EVEN MODIFY THESE!!! What are you trying to do? If you want to put some default text into the input fields, that's done like this:

> ACTION ="cgi-bin/alphamail_002.cgi" > Is there suppose to be a slash / in front of the cgi-bin? > (I added the slash and the script still didn’t work I took it back out) > ACTION="/cgi-bin/alphamail_002.cgi"

No, you don't need a slash. Again, your script works, the HTML form is wrong.

> The script doesn't mean your address, but the address of the person using the form. > I not clear on this. This .cgi script writes > # E-mail address to send intake form to (your address) > # If not using PERL 5, escape the @ thus: \@ instead of @ > $YourEmail = 'themustache@hotmail.com'; > What does the address of the person using the form have to do with anything in the above?

My quote (The script doesn't mean your address, but the address of the person using the form.) was just out of context. What I was trying to say: You got an error from the script telling you that there was no @ in the email address. You changed your email address in the script. But your email address isn't even checked by the script. What the script is checking is the address the user has entered in the HTML form. Since your form was wrong, the script delivered an error. Changing your email address in the script by adding a backslash (which is wrong in this place) doesn't have any effect on the error you get. I hope this is now clear.

> Why are the two dots necessary?

Um, that's a bit tough to say... From the webserver's point of view, the cgi-bin directory is a subdirectory of the www directory. That's why you can access CGI scripts from HTML located in the www directory by using a link cgi-bin/whatever.cgi. So, in exactly the same way, the www directory is a parent directory to the cgi-bin directory. And the two dots .. mean nothing but parent directory. So anytime you want to access a HTML file located in the www directory from within the cgi-bin directory, do it like this. I hope I didn't confuse you with this...

> Do I use this for every server I have my site on?

Yes, I guess this should work for most servers.

> Why does it always fail?

Oooo, I'm sure this will confuse you, but anyway, you asked for it. I've used the CGI module in the modified script. As soon as this module is used, it takes over the parsing of the form data, similarly to the ReadParse function in the script. Unfortunately, when this is done, there's nothing left to parse for ReadParse. And thus, the script will always fail because it never receives any data from even a valid HTML form. Nevertheless the modified script was useful, because it reminded me of the HTML form problem.

Your HTML page couldn't work, because it's simply not what I have sent to you. You changed the names of the form elements, and so the script doesn't find these elements. You've used EnterName instead of Name, themustache@hotmail.com instead of Email and TypeYourMessage instead of Message. I guess that's all that went wrong. You could do me a favor and answer another question: Why did you change nearly the only thing that could make it all fail before testing with what I've sent you?

I changed the NAME, EMAIL and MESSAGE fields because I misinterpreted an earlier message you wrote.

In Reply To

Now, upload the following HTML code and try it. Be sure to enter something in all three fields, and be sure to give it a valid email address.

I thought you meant enter something in the three fields (NAME, EMAIL and MESSAGE) within the FORM’s <html> code. It was a mistake totally on my part. I now understand you meant the three fields in the browser window.

In Reply To

> Can I put spaces in the name fields above?

**NO** YOU MAY NOT EVEN MODIFY THESE!!! What are you trying to do?

I totally made a mistake.

A few questions…

I don’t want the user to go to a THANK YOU page. Do I just comment out the second line below?

# URL to go to when form has been successfully submitted $ThankPage = "../a_thanks.html";

Well, everything works! Thank you so much. Your help is invaluable! However, this doesn’t mean I’m gonna stop bugging you!

I've just been testing your e-mailer and it worked perfectly.

In Reply To

I changed the NAME, EMAIL and MESSAGE fields because I misinterpreted an earlier message you wrote. Now, upload the following HTML code and try it. Be sure to enter something in all three fields, and be sure to give it a valid email address. I thought you meant enter something in the three fields (NAME, EMAIL and MESSAGE) within the FORM’s <html> code. It was a mistake totally on my part. I now understand you meant the three fields in the browser window.

Oooo, now I get it!!! Sorry I was confusing you. Perhaps it's due to my low-end english...

I don’t want the user to go to a THANK YOU page. Do I just comment out the second line below?

That wouldn't be a good idea, because you would end up nowhere. You've got to send the user somewhere. Simply enter the URL (can also be relative URL with '../') of the page you want the user to be sent to instead of '../a_thanks.html'.

In Reply To

I also don’t want an Autoresponse sent out. Do I just comment out the following…

That wouldn't be a good idea either, because the script wouldn't run anymore... But it's not far from the truth! Just comment this section out, as you proposed, but additionally, look through the script for any other occurrence of SendAutoReply. There should be only one, shortly after the section where you are told not to modify anything below, as far as I can recall. Comment this line out, too, and you should no longer be sending auto-replies.

Anyway, I don't think it's good to give no feedback to the user. I guess this is uncritical here, but I personally like to have feedback on forms I filled out, even if it costs me some clicks. That's why I like amazon, they tell me that my order has been placed on their page, they send me an email that it has been placed and what I've ordered, and they send me mail when they send my stuff out, so I always know what's going on. Personally, I'd keep the thankyou page (just redesign it a bit, it's really boring) and I'd make the autoreply optional. So a user can decide whether he wants to receive a copy of what he's sending you or not. This can be disabled by default. If you're interested in how to do this, just tell me.

Oooo, now I get it!!! Sorry I was confusing you. Perhaps it's due to my low-end english...

No, you weren’t confusing me. I was confusing myself. You explain things better than 99 per cent of the people I’ve talked with. You also have better English than most of the people I’m around. You’re very thorough, which is great!

In Reply To

I don’t want the user to go to a THANK YOU page. Do I just comment out the second line below?

That wouldn't be a good idea, because you would end up nowhere. You've got to send the user somewhere. Simply enter the URL (can also be relative URL with '../') of the page you want the user to be sent to instead of '../a_thanks.html'.

I don’t want the user to be sent to a thank you page. I don’t like that kind of thing. I have a great dhtml script that I’m gonna use for my forms.

You've got to send the user somewhere. Simply enter the URL (can also be relative URL with '../') of the page you want the user to be sent to instead of '../a_thanks.html'.

Does the above mean that I can also enter…

../a_some_page.html ?

In Reply To

I also don’t want an Autoresponse sent out. Do I just comment out the following…

That wouldn't be a good idea either, because the script wouldn't run anymore...

Are you pulling my leggy?

In Reply To

Personally, I'd keep the thankyou page (just redesign it a bit, it's really boring) and I'd make the autoreply optional. So a user can decide whether he wants to receive a copy of what he's sending you or not. This can be disabled by default. If you're interested in how to do this, just tell me.

Yes, that’s a great idea. I’d love to know how to make the auto-reply optional! That would totally suit the user and my needs.

You explain things better than 99 per cent of the people I’ve talked with. You also have better English than most of the people I’m around.

Thanks a lot, I'll give part of this back to my english teachers. Seems they did quite a good job...

In Reply To

I don’t want the user to be sent to a thank you page. I don’t like that kind of thing. I have a great dhtml script that I’m gonna use for my forms. If you’re interested here it is… DHTML Form enhancement In due time I have a few things I’d like to add to that DHTML script.

You mean that demo with the automatically disabling buttons? Ok, this might be a good solution!

In Reply To

Does the above mean that I can also enter… ../a_some_page.html ?

Exactly that is what it meas. You could also name it ../hello.html or even justanotherscript.cgi.

In Reply To

That wouldn't be a good idea either, because the script wouldn't run anymore... Are you pulling my leggy?

I just figured out how to implement the optional auto-reply. It's easier than I expected! You only have to modify a single line in the alphamail.cgi script. Search the line

Code

&SendAutoReply;

(must be near line 90 in the script). I think it's commented out in your script since you didn't like the auto-reply. Replace this line by

Code

&SendAutoReply if exists $in{'WantAutoReply'};

You also have to put the whole SendAutoReply function back in in case you commented this out, too. That's everything for the cgi script. Now, let's add the neccessary code to the HTML form. Just add the line

Code

<input type=checkbox name="WantAutoReply">Send me a copy of my mail!

anywhere you like it to appear, but inside the <form> tag. I've put it there to test it:

Just another question by myself: Do you use a tool for creating your HTML, like Frontpage or Dreamweaver? Or do you write it by hand, using an editor? I'm just wondering because I see all these <div>'s and really long <font> specs, which I rarely use. I prefer a good style sheet over having tons of <font> tags in the HTML, which then are also hard to keep consistent. But that's only personal interest.

In Reply To

When I press “Form Submission” I want a message to display (Example: Thank You).

Do you know how I can do this? I tried adjusting the <html>, but was unsuccessful. If you’re unsure it’s definitely OK. You’ve been so helpful!

I'd guess that's a slightly bigger problem now. The problem is, if you hit submit and thus the cgi-script is being activated, the script redirects you to some other - or even the same - page. This means the current page (the one with your forms) disappears, and is loaded again after completion of the cgi-script (if your forms page is entered where currently your thankyou page is entered in the script). Nevertheless, you information entered in that page is lost. I now have two ideas. One is that, perhaps, the cgi-script needn't do a redirection. But I don't think this is possible, because the script must do anything, I guess. But I'll figure this out. The other thing that comes to my mind would mean integrating your HTML form into the cgi script. This would definitely work, and you would have a lot more possibilities. But it would also mean to say goodbye to your HTML design tools, because AFAIK they don't support integration of HTML into cgi-scripts. Well, unfortunately no one-liner this time. But I can try to get something working if you like.

Bye, Marcus

P.S.: Thanks for the explanation. I guessed into that direction from context, but I wasn't sure...

Just another question by myself: Do you use a tool for creating your HTML, like Frontpage or Dreamweaver? Or do you write it by hand, using an editor? I'm just wondering because I see all these <div>'s and really long <font> specs, which I rarely use.

>>Do you know how I can do this? I tried adjusting the <html>, but was unsuccessful. If you’re unsure it’s definitely OK. You’ve been so helpful!

>I'd guess that's a slightly bigger problem now. The problem is, if you hit submit and thus the cgi-script is being activated, the script redirects you to some other - or even the same - page. This means the current page (the one with your forms) disappears, and is loaded again after completion of the cgi-script (if your forms page is entered where currently your thankyou page is entered in the script). Nevertheless, you information entered in that page is lost.

Well, I’ve decided that my page IS gonna re-direct to another page (Example…Thank You page). After someone presses “Form Submission” I still want a message to pop up (on the Form page).

I’m assuming that since my page will be re-directing that I’ll be able to get this message to appear?

The following dating site has a good example of the pop-up message I’m talking about. If you scroll to the bottom of the screen you’ll see the Form buttons (Search Current Ads) I’m talking about. Blinddate.com

In Reply To

The other thing that comes to my mind would mean integrating your HTML form into the cgi script. This would definitely work, and you would have a lot more possibilities. But it would also mean to say goodbye to your HTML design tools, because AFAIK they don't support integration of HTML into cgi-scripts.

Well, if I ever decide to integrate my html within a .cgi document then can’t I just do all my html formatting in say, Dreamweaver and then cut and paste it into my .cgi document (Example… <<ENDHTML … ENDHTML)?