Forum Moderators: coopster & phranque

Message Too Old, No Replies

What must I have to get a cgi form to work?

         

Knight_903

5:48 am on Apr 13, 2003 (gmt 0)

10+ Year Member



Guys I have a site were Im trying to get a membership form to work. I no nothing about all of this. I have a perl ans mysql thing on my web server (no nothing about that either lol) I would love to learn if some one could take the time to teach me. thx

wruk999

10:19 am on Apr 13, 2003 (gmt 0)

10+ Year Member



Hi Knight_903,

Firstly, welcome to WebmasterWorld. Be sure to read Marcia's welcome and giude to the basics [webmasterworld.com].

If you want just a simple form-to-email processing script, then you can use NMS formmail, which is probably the most-widely used cgi form processor. All you do is upload it to your cgi-bin and configure a set of variables.
Available from: [nms-cgi.sourceforge.net...]

If you want this membership form to write the data into a MySQL database as well, then imho your easiest way would be to use a php script. Have a look around www.hotscripts.com and in particular the php/tips_and_tutorials section, and look for inserting data into a MySQL database.

If you have any problems, just come back and ask!

Regards,
William.

Knight_903

4:38 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



So I dont have to do any wild programing in my sql or perl

[edited by: Knight_903 at 4:41 pm (utc) on April 13, 2003]

wruk999

4:39 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



depends on what you want to do?

do you want it just to email you the results of a form, or do you want it to insert into a database?

Regards,
wruk999

Knight_903

4:40 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



I downloaded that scrip last night after reanding some other post. So this is what actually send the form as a text mail..

Knight_903

4:41 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



yes just to email the form info. It for a clan web site for a membership form..

wruk999

4:43 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



Yup!
Just configure your script, with the necessary variables, place it into your cgi-bin/ directory.
Then set up your form on your page as instructed.

Remember: Make sure you set the referrers array up properly!

Let us know how you get on.

Regards,
wruk999

[edited by: wruk999 at 4:44 pm (utc) on April 13, 2003]

Knight_903

4:43 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



sry im proubly asking alot of dum questions but is the pl file what I upload to the cgi-bin file?

wruk999

4:45 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



Yes.
Upload it to the cgi-bin directory.

Knight_903

4:46 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



lol man your going to get tired of me but can you give me a hint on what I need to change in here

Knight_903

4:49 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



$mailprog = '/usr/sbin/sendmail -oi -t';
$postmaster = 'fred@your.domain';
@referers = qw(www.your.domain);
@allow_mail_to = qw(your-name@your.domain);

Ok I think I have to change everthing that say your domain right? but what about the $mailprog line do I have to change it?

wruk999

4:51 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



if you want to use the sendmail programme with apache, then you should be able to use it as it is.

If it doesn't work, let me know, and I'll give you the script to test where it is.

Knight_903

4:52 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



One more question when I open up the actual pl file its all jumpled up threw notepad is that how it suppose to be

Knight_903

4:52 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



ok thanks

wruk999

4:54 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



it is how notepad interprets it.
you could try opening it in wordpad, or download editplus (unix-style textpad for windows)

Knight_903

5:01 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



ok I got a 404 error and nothing in the email

Knight_903

5:03 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



this is my form I coped it from a site I use to have but they had all the cgi bin stuff allready configured...

<HTML>

<HEAD>
<STYLE TYPE="text/css">
BODY
{scrollbar-arrow-color: #0000FF;scrollbar-base-color: #000000;scrollbar-DarkShadow-color: #0000FF}</STYLE>

<TITLE>your domain RECRUITMENT FORM</TITLE>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>

<BODY BGCOLOR="#000000" text="#FFFFFF">

<FORM action=" [yourdomain.com...] method="POST">

<H1><CENTER>&nbsp;</CENTER></H1>

<H1><CENTER><FONT COLOR="#ffffff" size="5">Welcome to the xxxxxxxxx Recruitment page.
Please fill in all the info that is asked of you and hit submit key at the
bottom. You have to be above the age of 18 to qualify for our squad. You should
be contacted within a couple of days by our recruiter. Thx for applying. COL.
KNIGHT </FONT>

</CENTER></H1>

<H3><CENTER>

<INPUT TYPE="hidden" NAME="your_email_address" VALUE="command@yourdomain.com">

<INPUT TYPE="hidden" NAME="your_name" VALUE="COL. KNIGHT">

<INPUT TYPE="hidden" NAME="email_subject_line" VALUE="This is from the recruitment form">

<INPUT TYPE="hidden" NAME="required_fields" VALUE="recrutiment@yourdomain.com">

<INPUT TYPE="hidden" NAME="thank_you_title" VALUE="Thank for applying at xxxxxxxxxxxx">

<INPUT TYPE="hidden" NAME="return_link_url" VALUE="http://www.yourdomain.com/body.htm">

<INPUT TYPE="hidden" NAME="return_link_name" VALUE="Back">

<INPUT TYPE="hidden" NAME="background_color" VALUE="#000000">

<INPUT TYPE="hidden" NAME="text_color" VALUE="#FFFFFF">

<INPUT TYPE="hidden" NAME="link_color" VALUE="#FFFFFF">

<INPUT TYPE="hidden" NAME="visited_link_color" VALUE="#FFFFFF">

<INPUT TYPE="hidden" NAME="active_link_color" VALUE="#FFFFFF">

</CENTER></H3>

<H3><CENTER>
<table width="859" height="351" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td width="286" height="26"><font size="4">Enter Real Name:</font></td>
<td width="260" height="26"> <input type="text" name="Your Real Name:">
</td>
</tr>
<tr>
<td width="286" height="26"><font size="4">Enter your ICQ #:</font></td>
<td width="260" height="26"> <input type="text" name="Enter your icq #:">
</td>
</tr>
<tr>
<td width="286"><font size="4">Game call sign:</font></td>
<td width="260"> <input type="text" name="game call sign:"> </td>
</tr>
<tr>
<td width="286"><font size="4">State You Live In:</font></td>
<td width="260"> <input type="text" name="State You live in:"> </td>
</tr>
<tr>
<td width="286"><font size="4">Your Age:</font></td>
<td width="260"> <input type="text" name="Your age:"> </td>
</tr>
<tr>
<td width="286"><font size="4">How Long have you been playing:</font></td>
<td width="260"> <input type="text" name="How long have you been playing:"size="25">
</td>
</tr>
<tr>
<td width="286"><font size="4">How often do you get to play:</font></td>
<td width="260"> <input type="text" name="How often do you play:" size="25">
</td>
</tr>
<tr>
<td width="286"><font size="4">How did you hear of the xxxxxxxx:</font></td>
<td width="260"> <input type="text" name="How did you hear of the xxxxxxxxxx:" size="25">
</td>
</tr>
<tr>
<td width="286"><font size="4">When Is a good time for a tryout:</font></td>
<td width="260"> <input type="text" name="When is a good time for a tryout:" size="25">
</td>
</tr>
<tr>
<td width="286"><font size="4">Your Email address:</font></td>
<td width="260"> <input type="text" name="Email address:" size="25">
</td>
</tr>
<tr>
<td width="286" height="26"><font size="4">What type of connection do
you have</font></td>
<td width="260" height="26"> <input type="text" name="What type of connection do you have:">
</td>
</tr>
<tr>
<td width="286"><font size="4">Do you agree to ICE bylaws:</font></td>
<td width="260"> <p> <font size="4">
<input type="checkbox" name="Do you agree to bylaws" value="yes">
Yes</font></p>
<p> <font size="4">
<input type="checkbox" name="Do you agree to bylaws" value="no">
No </font></p></td>
</tr>
</table>
</CENTER></H3>

<P>&nbsp;</P>

<BLOCKQUOTE>
<P align="center">
<INPUT TYPE="submit" NAME="Submit"

VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset">
</P>
</BLOCKQUOTE>

<P>&nbsp;</P>

</FORM>

</BODY>

</HTML>

[edited by: Knight_903 at 5:09 pm (utc) on April 13, 2003]

wruk999

5:03 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



can you post us your form html - just the bit concerning the form will do (but remember to remove your domain!)

Knight_903

5:08 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



is that not what I just posted?

mat

5:10 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



Your form 'action' shouldn't be pointing at the sendmail location, it should be pointing at formmail.pl in your cgi-bin ... something like

<FORM action=" [yourdomain.com...] method="POST">

wruk999

5:10 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



this is more like what it should be:

<form method="post" action="/cgi-bin/FormMail.pl">
<input type="hidden" name="recipient" value="email@domain.com">
<input type="hidden" name="redirect" value="http://domain.com/reply.html">

you have called a directory, instead of the .pl script itself

<added>

is that not what I just posted?

Look at the time I posted - exactly the same time as you.
</added>

Knight_903

5:20 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



<FORM action=" [yourdomain.com...] method="POST">

i made that change and i still get the 404 error

wruk999

5:20 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



Knight,
Check your stick for an entire form example script.

Hope it helps you. As mat said, you need to call the actual script.

HTH,
wruk999

Knight_903

5:25 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



ok im looking for the Sendmail Path right? /usr/sbin/sendmail

wruk999

5:27 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



on the form (html) page, you need to call the FormMail.pl file, like I posted a few posts ago.
You can't call the sendmail prog from a html page.

(The sticky I sent you shows how the top should be)

Knight_903

7:03 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



Ok I think I understand what you are saying the
<form method="post" action="/cgi-bin/FormMail.pl">
<input type="hidden" name="recipient" value="email@domain.com">
<input type="hidden" name="redirect" value="http://domain.com/reply.html">
<HTML>

<HEAD>
<STYLE TYPE="text/css">
BODY
{scrollbar-arrow-color: #0000FF;scrollbar-base-color: #000000;scrollbar-DarkShadow-color: #0000FF}</STYLE>

<TITLE>your domain RECRUITMENT FORM</TITLE>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>

<BODY BGCOLOR="#000000" text="#FFFFFF">

ect>>>

wruk999

7:40 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



no. the <form> tags must close around the form, which must all be _inside_ the <body> tags.

I shall sticky you an entire page copy html and comment in instructions.

wruk999

Knight_903

8:37 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



Ok is this whatyou mean
<HTML>

<HEAD>
<STYLE TYPE="text/css">
BODY
{scrollbar-arrow-color: #0000FF;scrollbar-base-color: #000000;scrollbar-DarkShadow-color: #0000FF}</STYLE>

<TITLE> RECRUITMENT FORM</TITLE>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>

<BODY BGCOLOR="#000000" text="#FFFFFF">

<H1><CENTER>&nbsp;</CENTER></H1>

<H1><CENTER><FONT COLOR="#ffffff" size="5">Welcome to the Recruitment page.
Please fill in all the info that is asked of you and hit submit key at the
bottom. You have to be above the age of 18 to qualify for our squad. You should
be contacted within a couple of days by our recruiter. Thx for applying. COL.
KNIGHT </FONT>

</CENTER></H1>

<H3><CENTER>
<form
<form name= "form 1" method="post" action="/cgi-bin/FormMail.pl">

<INPUT TYPE="hidden" NAME="your_email_address" VALUE="command@yourdomain.com">

<INPUT TYPE="hidden" NAME="your_name" VALUE="COL. KNIGHT">

<INPUT TYPE="hidden" NAME="email_subject_line" VALUE="This is from the recruitment form">

<INPUT TYPE="hidden" NAME="required_fields" VALUE="recrutiment@yourdomain.com">

<INPUT TYPE="hidden" NAME="thank_you_title" VALUE="Thank for applying at squad">

<INPUT TYPE="hidden" NAME="return_link_url" VALUE="http://www.yourdomain.com/body.htm">

<INPUT TYPE="hidden" NAME="return_link_name" VALUE="Back">

<INPUT TYPE="hidden" NAME="background_color" VALUE="#000000">

<INPUT TYPE="hidden" NAME="text_color" VALUE="#FFFFFF">

<INPUT TYPE="hidden" NAME="link_color" VALUE="#FFFFFF">

<INPUT TYPE="hidden" NAME="visited_link_color" VALUE="#FFFFFF">

<INPUT TYPE="hidden" NAME="active_link_color" VALUE="#FFFFFF">

</CENTER></H3>

<H3><CENTER>
<table width="859" height="351" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td width="286" height="26"><font size="4">Enter Real Name:</font></td>
<td width="260" height="26"> <input type="text" name="Your Real Name:">
</td>
</tr>
<tr>
<td width="286" height="26"><font size="4">Enter your ICQ #:</font></td>
<td width="260" height="26"> <input type="text" name="Enter your icq #:">
</td>
</tr>
<tr>
<td width="286"><font size="4">Game call sign:</font></td>
<td width="260"> <input type="text" name="game call sign:"> </td>
</tr>
<tr>
<td width="286"><font size="4">State You Live In:</font></td>
<td width="260"> <input type="text" name="State You live in:"> </td>
</tr>
<tr>
<td width="286"><font size="4">Your Age:</font></td>
<td width="260"> <input type="text" name="Your age:"> </td>
</tr>
<tr>
<td width="286"><font size="4">How Long have you been playing:</font></td>
<td width="260"> <input type="text" name="How long have you been playing:"size="25">
</td>
</tr>
<tr>
<td width="286"><font size="4">How often do you get to play:</font></td>
<td width="260"> <input type="text" name="How often do you play:" size="25">
</td>
</tr>
<tr>
<td width="286"><font size="4">How did you hear of the squad:</font></td>
<td width="260"> <input type="text" name="How did you hear of the squad:" size="25">
</td>
</tr>
<tr>
<td width="286"><font size="4">When Is a good time for a tryout:</font></td>
<td width="260"> <input type="text" name="When is a good time for a tryout:" size="25">
</td>
</tr>
<tr>
<td width="286"><font size="4">Your Email address:</font></td>
<td width="260"> <input type="text" name="Email address:" size="25">
</td>
</tr>
<tr>
<td width="286" height="26"><font size="4">What type of connection do
you have</font></td>
<td width="260" height="26"> <input type="text" name="What type of connection do you have:">
</td>
</tr>
<tr>
<td width="286"><font size="4">Do you agree to ICE bylaws:</font></td>
<td width="260"> <p> <font size="4">
<input type="checkbox" name="Do you agree to bylaws" value="yes">
Yes</font></p>
<p> <font size="4">
<input type="checkbox" name="Do you agree to bylaws" value="no">
No </font></p></td>
</tr>
</table>
</CENTER></H3>

<P>&nbsp;</P>

<BLOCKQUOTE>
<P align="center">
<INPUT TYPE="submit" NAME="Submit"

VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset">
</P>
</BLOCKQUOTE>

<P>&nbsp;</P>

</FORM>

</BODY>

</HTML>

wruk999

9:13 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



I have stickied you the corrected version of what you just posted. You will need to make sure that the hidden fields are correct.

ie: i think "your_email_address" should be "recipient"

[you need to read the 'readme' file distributed with the formmail package]

Let us know how you get on!

wruk999

<edit>typo</edit>

Knight_903

9:27 pm on Apr 13, 2003 (gmt 0)

10+ Year Member



Hey man Im sry I just figured out what stickey mail was lol . thx for your help
This 37 message thread spans 2 pages: 37