I have a php form, that uses a javascript word counter to make sure
submissions are a certain number of words, I have now been tasked with
taking that word count and having it pass in the email that gets sent when
someone submits a form ..in the subject line.
Here is the code I'm using so far. Is it possible to just echo a
javascript variable on a page like you can a php var?
========================CODE=========================
// Enter in a subject line for the email.
$_SESSION['EmailSubject'] = "Letter to the Editor echo('submitcount')";
<---- I want to just echo it..possible??
//Thank you text
$_SESSION['ThankYou'] = "Thank you for participating\\n\\nYour comments have
been sent to our newsroom. \\nIf our writers or editors have any questions
about your letter, you will receive a reply via phone or e-mail. ";
?>
<script language="javascript">
var submitcount=0;
function checkSubmit() {
if (submitcount == 0)
{
submitcount++;
document.Surv.submit();
}
}
function wordCounter(field, countfield, maxlimit) {
wordcounter=0;
for (x=0;x<field.value.length;x++) {
if (field.value.charAt(x) == " " && field.value.charAt(x-1) != " ")
{wordcounter++} // Counts the spaces while ignoring double spaces, usually
one in between each word.
if (wordcounter > 300) {field.value = field.value.substring(0, x);}
else {countfield.value = maxlimit - wordcounter;}
}
}
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
{field.value = field.value.substring(0, maxlimit);}
else
{countfield.value = maxlimit - field.value.length;}
}
</script>
===================END CODE==========================================
Thanks
Terion
Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.
Report Moderator Abuse Here:
http://www.freecycle.org/faq/faq/contact-info
Or Email Your Complaint to:
[email protected] or [email protected]
------------------------------------------------
Twitter?
http://twitter.com/terionmiller
------------------------------------------------
Facebook:
<a href="http://www.facebook.com/people/Terion-Miller/1542024891"
title="Terion Miller's Facebook profile" target=_TOP><img src="
http://badge.facebook.com/badge/1542024891.237.919247960.png" border=0
alt="Terion Miller's Facebook profile"></a>