PDA

View Full Version : forms script


collie
08-13-2003, 11:24 PM
Confused on how this script works. After the form is filled in and the submit button is than hit. What lines have to be changed so that i would receive the form info. There are two lines within this script that i dont understand. thanks in advance

<form method=post action=http://cgi.freedback.com/mail.pl"
(this line the post action i dont know what its trying to do)

<inpuy type=hidden name=to value="you@your-website-address-here.com">( on this line you@ i dont understand)

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var submitcount=0;

function reset() {
document.emailform.name.value="";
document.emailform.email.value="";
document.emailform.comments.value="";
}

function checkFields() { // field validation -
if ( (document.emailform.name.value=="") || // checks if fields are blank.
(document.emailform.email.value=="") || // More validation scripts at
(document.emailform.comments.value=="") ) // forms.javascriptsource.com
{
alert("Please enter your name, email, and comments then re-submit this form.");
return false;
}

else
{
if (submitcount == 0)
{
submitcount++;
return true;
}
else
{
alert("This form has already been submitted. Thanks!");
return false;
}
}
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

<BODY OnLoad="reset()">

<!-- STEP THREE: Copy this code into the BODY of your HTML document -->

<form method=post action="http://cgi.freedback.com/mail.pl" name="emailform" onSubmit="return checkFields()">

<input type=hidden name=to value="you@your-website-address-here.com">
<input type=hidden name=subject value="Feedback Form">

<pre>
Your Name: <input type=text name="name">
Your Email: <input type=text name="email">

Comments?

<textarea name="comments" wrap="virtual" rows="7" cols="45"></Textarea>

<input type=submit value="Submit Form!">

</pre>
</form>

</html>

whammy
08-14-2003, 12:29 AM
The first line submits the form to a perl script which processes the form.

The second line in question is a parameter that's passed to the perl script so it knows who to send the form to after it's processed.

Unless you have the formmail script installed in your cgi-bin, it won't work (assuming you're posting it to your own server)... what server-side languages does your webhost support?

P.S. The second line won't work anyway, since there's no such thing as <inpuy type> ;)

collie
08-14-2003, 01:21 AM
thanks for the spelling lesson. Webhost supports perl. I never worked in perl before so this should be a treat, maybe. I never worked with a form before this. IF I put this form up on the server (cgi-bin) there is nothing extra to configure since it does host perl scripting?

whammy
08-14-2003, 01:29 AM
Good question for me, too.

I usually use ASP to process my forms. If I were you I'd look for instructions on using formmail.pl - they might even be provided by your host? If not, you can google it. :D

collie
08-14-2003, 01:38 AM
Will take advice. ASP stands for?????. I will say goodnight and thanks.
Ron

whammy
08-14-2003, 01:41 AM
ASP is a server-side language (like PERL) and stands for Active Server Pages. I'm trying to get away from that actually and program in .NET - but it seems nearly impossible at this point (for me) - since I have to maintain and fix code that has always been in ASP - quickly. :)