Hi there, I am looking to setup an email form where one of the textboxes has a character countdown function, like so:

I succesfully setup my email form, but whenever I try to add the character countdown, the form throws up an Internal Server Error page. See example here:

I am sure I've badly mangled the code...

<meta http-equiv="Content-Language" content="en-us">

<script language="javascript" type="text/javascript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
countfield.value = maxlimit - field.value.length;
// End -->


<form action="/cgi-bin/chfeedback.pl" method="post">
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
<tr><td>Name:</td><td><input type="text" name="name" size="25" /></td></tr>
<tr><td>Email address:</td><td><input type="text" name="email" size="25" /></td></tr>
<td colspan="2">
Comments<br />
<!-- textCounter() parameters are: text field, the count field, max length -->

<textarea name="comments" wrap=physical cols=28 rows=6 onKeyDown="textCounter(this.form.message,this.form.remLen,140);" onKeyUp="textCounter(this.form.message,this.form.remLen,140);"></textarea>
<input readonly type=text name=remLen size=3 maxlength=3 value="140"> characters left</font>

<td align="center" colspan="2">
<input type="submit" value="Fire!" /><br />
<a href="http://www.thesitewizard.com/">Powered by thesitewizard.com</a>



I am hoping to use this as a mail-to-SMS form, so the content of the email should list certain information, such as the mobile number, name of the sender and message in the body of the email. I've tried to meddle with the code in the perl file, but I've hopelessly messed it up everytime. The closest I got was getting all the info I wanted, but all in one line, withnospaces.

I'd be really happy if I could get rid of the "----COMMENTS----" line as well.

Here's the bit I'm think I'm supposed to change...


my $http_referer = $ENV{ 'HTTP_REFERER' };
my $message =
"This message was sent from:\n" .
"$http_referer\n" .
"This message was sent from:\n" .
"$http_referer\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

send_email ( $mailprog, $email, $name, $mailto, $subject, $message );
redirect_url( $thankyouurl );


I don't know if this is the best script to use. Is there another one anybody could recommend that would allow me to use with several forms, mail to several recipients and ensure the fields are filled out?

Thanks for any advise that you might throw my way!