LexiConn Knowledgebase

Knowledgebase Home | Favorites Knowledgebase Home | Favorites
Search the Knowledgebase Browse by Category
formmail.php
Article Details

Last Updated
13th of January, 2009

User Opinions (597 votes)
83% thumbs up 16% thumbs down

How would you rate this answer?
Helpful
Not helpful

formmail.php (tectite formmail) is another form processing script that LexiConn offers. It has features such as "CAPTCHA" image verification, required fields, spam filtering, and advanced formatting. It is located in the "scripts" directory. If you do not have this script, let us know, and we can install it.

Simple formmail.php example:

<form action="http://www.Your_Domain.com/scripts/formmail.php" method="post">
    <input type="hidden" name="recipients" value="you@Your_Domain.com">
    <input type="hidden" name="subject" value="Subject of email">
    <input type="hidden" name="good_url" value="http://www.Your_Domain.com/thankyoupage.html">
    Name: <input type="text" name="name"><br />
    Email: <input type="text" name="email"><br />
    Comments:<br />
	<textarea name="comments" cols="40" rows="10"></textarea><br>
    <input type="submit" name="submit" value="Submit">
</form>


Adding Captcha Image verification to a form:

(Note: Image verification requires that the user is not blocking cookies in order to track that they entered the correct text. If you want image verification to work without requiring cookies, you will need to make your form webpage a PHP page, and follow the tectite instructions)

Add the code below to the top of your form page:

<script language="javascript" type="text/javascript">
var nReload = 5;

function NewVerifyImage()
{
    if (nReload <= 2)
        if (nReload <= 0)
        {
            alert("Sorry, too many reloads.");
            return;
        }
        else
            alert("Only " + nReload + " more reloads are allowed");
    nReload--;

        //
        // This code now works in both IE and FireFox
        //
    var         e_img;

    e_img = document.getElementById("vimg");
    if (e_img)
                //
                // FireFox attempts to "optimize" by not reloading
                // the image if the URL value doesn't actually change.
                // So, we make it change by adding a different
                // count parameter for each reload.
                //
        e_img.setAttribute("src",e_img.src+'?count='+nReload);
}
// -->
</script>

Add a hidden field to require the image verification:

<input type="hidden" name="required" value="imgverify:<em>The text shown in the image" />
		

Add this code to put the image verification on your form:

Please enter the characters you see in the image:<br>
<img src="http://www.Your_Domain.com/scripts/verifyimg.php" alt="Image verification" name="vimg" id="vimg"> 
<input type="text" size="12" name="imgverify"><p>
If you cannot read the image, click for a new one <button onclick="NewVerifyImage(); return false;">New image</button>
		

For more advanced formmail.php examples, reference the Tectite Documentation.
Related Articles
Attachments
No attachments were found.

Powered by Interspire Knowledge Manager Knowledgebase Software