Lunarpages Web Hosting Forum

Author Topic: Can't quite figure out Form Mail... Help?  (Read 15678 times)

Offline jen123

  • Space Explorer
  • ***
  • Posts: 8
Can't quite figure out Form Mail... Help?
« on: October 18, 2005, 02:45:02 PM »
Hi. I've been reading this site for two days trying to figure this out. I did get the FormMail script from leighsww, downloaded it and made the changes as indicated (I thought). I'll probably sound like a complete idiot, but when the directions start under

THE HTML FORM:

Step 1) the "action" tag should look like this:

Code:
<form method="post" action="/cgi-bin/scriptname.pl">

* NOTE: Replace "scriptname" with whatever you named your formmail script to.


What does the "action" tag refer to? I tried putting this script in the Tag/Behaviors/'On Click' but it doesn't seem to work. Also, after testing the Submit button I don't get the 'Thank You' page.
Any help would be appreciated.

Here's what I have:
BEGIN
{
  $DEBUGGING         = 1;
  $emulate_matts_code= 0;
  $secure            = 1;
  $allow_empty_ref   = 1;
  $max_recipients    = 5;
  $mailprog          = '/usr/sbin/sendmail -oi -t';
  $postmaster        = '';
  @referers          = qw(lansllc.com localhost);
  @allow_mail_to     = qw(suggestions@lansllc.com localhost);
  @recipients        = ();
  %recipient_alias   = ();
  @valid_ENV         = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
  $locale            = '';
  $charset           = 'iso-8859-1';
  $date_fmt          = '%A, %B %d, %Y at %H:%M:%S';
  $style             = '/css/nms.css';
  $no_content        = 0;
  $double_spacing    = 1;
  $wrap_text         = 0;
  $wrap_style        = 1;
  $address_style     = 0;
  $send_confirmation_mail = 0;
  $confirmation_text = <<'END_OF_CONFIRMATION';
From: user@lansllc.com
Subject: form submission

leighsww

  • Guest
Re: Can't quite figure out Form Mail... Help?
« Reply #1 on: October 18, 2005, 02:46:25 PM »
Please provide a link to your form, so I can help you better.

Offline jen123

  • Space Explorer
  • ***
  • Posts: 8
Re: Can't quite figure out Form Mail... Help?
« Reply #2 on: October 18, 2005, 02:55:42 PM »
Thank you.

http://www.staging.lansllc.com/suggestions.html

It has a password.... is there a place I can email it to you?

leighsww

  • Guest
Re: Can't quite figure out Form Mail... Help?
« Reply #3 on: October 18, 2005, 02:57:02 PM »
IM it to me. You see below my avatar to the left, click on the bubble that has an "IM" in it.

leighsww

  • Guest
Re: Can't quite figure out Form Mail... Help?
« Reply #4 on: October 18, 2005, 03:02:10 PM »
It's not letting me access. Double check that you sent me the correct info. The server is case sensitive.

It might be easier if you take the password protection off until we get your form to work.

Offline jen123

  • Space Explorer
  • ***
  • Posts: 8
Re: Can't quite figure out Form Mail... Help?
« Reply #5 on: October 18, 2005, 03:07:18 PM »
o.k. password is off. :D

leighsww

  • Guest
Re: Can't quite figure out Form Mail... Help?
« Reply #6 on: October 18, 2005, 03:22:43 PM »
Okay, first off, this is the "action" line that you have in your form right now:

Quote
<form action="mailto:suggestions@lansllc.com" method="post" enctype="text/plain" name="Suggestions" id="Suggestions">

That is incorrect and should look something like this:

Quote
<form action="/cgi-bin/filename.pl" method="post" enctype="text/plain" name="Suggestions" id="Suggestions">

Replace "filename.pl" with whatever you named your script.

You also have your form fields incorrect. You have them looking like this:

Quote
<input name="textfield" type="text" class="Style22" value="Enter name (optional)" size="60">
<input name="textfield" type="text" class="Style22" value="Email" size="60">

The "name" part of the tag has to be unique for each item (right now you have them all as "textfield"). So, your tags should be something more like this:

Quote
<input name="realname" type="text" class="Style22" value="Enter name (optional)" size="60">
<input name="email" type="text" class="Style22" value="Email" size="60">

The second tag has to have the word "email" for the "name" be in ALL lowercase letters, because the script uses that variable. The "value" part can be initial caps, because that's only used by the form (not the script).

For the first tag, I used "realname" because the script uses that variable, as well, but you can actually name that anything else (ex: name, fullname, etc.) because it isn't as important for that to be used by the script, as the "email" one is.

You need to make changes to your form everywhere you have your field names as "textfield"

After you are done with the changes, if your form still doesn't work, post back here.

Did you put your .pl script in the cgi-bin? Also, did you follow the instructions in my tutorial regarding setting the permission on that .pl file to 755? If you did not do those things, then you need to re-read my tutorial and follow the instructions step-by-step.

If you still can't get it to work after doing this, then IM me your username and password that you use to login to cPanel and I will go in and look to see what's the problem.
« Last Edit: October 18, 2005, 04:52:07 PM by leighsww »

Offline jen123

  • Space Explorer
  • ***
  • Posts: 8
Re: Can't quite figure out Form Mail... Help?
« Reply #7 on: October 18, 2005, 03:27:19 PM »
Thank you. I will try all of these things.

Offline jen123

  • Space Explorer
  • ***
  • Posts: 8
Re: Can't quite figure out Form Mail... Help?
« Reply #8 on: October 18, 2005, 04:38:02 PM »
Hi. o.k., I did these things and now when I hit the Submit button, I get an Error 404. I'll look on old posts... I seem to remember that one coming up before. I'll also check back here later in case you have time to give me a hint.
Thank you for your help.

leighsww

  • Guest
Re: Can't quite figure out Form Mail... Help?
« Reply #9 on: October 18, 2005, 04:44:39 PM »
The "Not Found" error means that it couldn't find the "lans_suggestion_reply.pl" file in your cgi-bin folder.

Make sure you have that file in there and spelled exactly how you have it in your html form (all lowercase and with the underscores).


leighsww

  • Guest
Re: Can't quite figure out Form Mail... Help?
« Reply #10 on: October 18, 2005, 04:47:54 PM »
Also, I just noticed that you are calling the form from a subdomain, so if you are using a subdomain to access your form, you should use the cgi-bin in the subdomain folder. If you do not have a cgi-bin in your subdomain's folder, then you need to create one. Then copy the .pl file into that subdomain's cgi-bin.
« Last Edit: October 18, 2005, 05:28:28 PM by leighsww »

Offline jen123

  • Space Explorer
  • ***
  • Posts: 8
Re: Can't quite figure out Form Mail... Help?
« Reply #11 on: October 18, 2005, 07:50:59 PM »
You were so right about the subdomain. I created a cgi-bin folder and put the file in that folder. Unfortunately now I'm getting a server error (?). If you're not bored with this.... do you have any insight to that one? I'll also search former posts...
Thank you for your help.

leighsww

  • Guest
Re: Can't quite figure out Form Mail... Help?
« Reply #12 on: October 19, 2005, 12:08:49 AM »
Server error is usually any of the following things (view the .pl script's code via the server, not your computer, to check the following):

1) Chmod/Permission on the .pl file should be set to 755. If it is not 755, then here's instructions on setting permissions via cPanel:

http://www.lunarforums.com/forum/index.php?topic=18221.msg218534#msg218534

2) Check the code and make sure it isn't scrambled. If it is scrambled, then you need to upload the file in ASCII (text) mode and NOT binary mode (if you uploaded the file via cPanel, this wouldn't be an issue, this pertains to using an FTP client).

3) Make sure that the script is intact, and has not been truncated (match the bottom of the script with the original version). If it is missing code, then you need to start over with a fresh copy.

4) Make sure that the lines of the CONFIGURATION section are single-spaced and NOT double-spaced. If it is double-spaced, it means you are using a text editor that adds formatting, thus download and install "Programmer's Notepad" and use it instead --> http://www.pnotepad.org/

If any of those still do not fix it, then start all over with a fresh copy of the NMS FormMail script. When editing the script, if you are using Programmer's Notepad, WordPad or comparable text editor (DO NOT use MS Word, that program adds formatting that will screw up your code), SAVE as "Text Document" (if the program gives that option), DO NOT save as "Rich Text Format". Make sure to rename your file with the .pl extension (NOT ".txt"). After saving the file, open it up again to make sure the code did not get scrambled upon saving (this normally would be the case with Notepad, not so much with other text editors).
« Last Edit: April 01, 2007, 08:34:07 PM by leighsww »

Offline jen123

  • Space Explorer
  • ***
  • Posts: 8
Re: Can't quite figure out Form Mail... Help?
« Reply #13 on: October 19, 2005, 08:15:36 AM »
I'm at a loss. I know that numbers 1 and 4 are correct. When I open the script in Notepad, it comes in scrambled. When I open it in Wordpad it has editable lines. I tried opening it first in Wordpad, changing the few lines I'm supposed to, saving it as a .txt since it won't let me save it as .pl, and changing the extension to .pl.
This is most likely my mistake but I'm not sure how else to do it. I'll IM my user name and password and hopefully you'll have time to look at it (?).
Thank you for your help--It's really amazing that you help people the way you do.

leighsww

  • Guest
Re: Can't quite figure out Form Mail... Help?
« Reply #14 on: October 19, 2005, 10:14:50 AM »
Okay, all fixed.

The problem was that you had parts of the MANIFEST and CHANGELOG files inside the .pl file. Did you copy the contents of those files into the .pl file? If not, then something weird happened to merge the contents of those files together.

Anyway, I sent you some tests, so let me know if you received them. I did several tests, because the default success (thank you) page was stringing all the field items into one line, so I had to figure out why that was. You had the "enctype="text/plain" in the "action" tag which was causing that. I took it out, but if you had a particular reason you wanted it in there, then you need to put it back, but I then would suggest that you use your own "Thank You" page and not the default one. To do that you add the "redirect" hidden tag into your html form.

I have instructions on adding "hidden" tags for the "subject," "redirect" and "required" tags in "The HTML FORM" section (Step #3) of the tutorial found in the following link:

http://www.lunarforums.com/forum/index.php?topic=18221.0
« Last Edit: October 19, 2005, 10:17:16 AM by leighsww »