If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    bwd is offline
    Junior Member
    Join Date
    Apr 2012
    Member #
    Hi, I am using this PHP form on a site I am doing for a friend:

    You can view their demo of the form here:

    The page I am attempting to get the form to work on is here:

    file isn't loading, according to Firebug.

    The feedback.php file calls the contact form, here is the code for feedback.php:

    <?php include $_SERVER['DOCUMENT_ROOT'] . '/php/headercontact.php'; ?>
    <body id="feedback">
    <div id="container">
    <?php include $_SERVER['DOCUMENT_ROOT'] . '/php/headernav.php'; ?>
    <div id="body" class="clear">
    <?php include $_SERVER['DOCUMENT_ROOT'] . '/php/mainnav.php'; ?>
    <div id="border">
    <div id="maincontent">
    <div class="column1">
    <?php include $_SERVER['DOCUMENT_ROOT'] . '/php/contactform.php'; ?>
    <!-- END OF COLUMN1 -->
    <!-- END OF BORDER -->
    <?php include $_SERVER['DOCUMENT_ROOT'] . '/php/footer.php'; ?>
    I think the problem is on line 74 of contactform.php, which is:

    <div><img alt='Captcha image' src='show-captcha.php?rand=1' id='scaptcha_img' /></div>

    This is contactform.php:

        Contact Form from HTML Form Guide
        This program is free software published under the
        terms of the GNU Lesser General Public License.
        See this page for more info:
    $formproc = new FGContactForm();
    $captcha = new FGCaptchaCreator('scaptcha');
    //1. Add your email address here.
    //You can add more than one receipients.
    $formproc->AddRecipient(''); //<<---Put your email address here
    //2. For better security. Get a random tring from this link:
    // and put it here
    <!-- Form Code Start -->
    <form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'
    <fieldset >
    <legend>Contact us</legend>
    <input type='hidden' name='submitted' id='submitted' value='1'/>
    <input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
    <input type='text'  class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' />
    <div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div>
    <div class='container'>
        <label for='name' >Your Full Name*: </label><br/>
        <input type='text' name='name' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' maxlength="50" /><br/>
        <span id='contactus_name_errorloc' class='error'></span>
    <div class='container'>
        <label for='email' >Email Address*:</label><br/>
        <input type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/>
        <span id='contactus_email_errorloc' class='error'></span>
    <div class='container'>
        <label for='message' >Message:</label><br/>
        <span id='contactus_message_errorloc' class='error'></span>
        <textarea rows="10" cols="50" name='message' id='message'><?php echo $formproc->SafeDisplay('message') ?></textarea>
    <div class='container'>
        <label for='photo' >Upload your photo:</label><br/>
        <input type="file" name='photo' id='photo' /><br/>
        <span id='contactus_photo_errorloc' class='error'></span>
    <div class='container'>
        <div><img alt='Captcha image' src='show-captcha.php?rand=1' id='scaptcha_img' /></div>
        <label for='scaptcha' >Enter the code above here:</label>
        <input type='text' name='scaptcha' id='scaptcha' maxlength="10" /><br/>
        <span id='contactus_scaptcha_errorloc' class='error'></span>
        <div class='short_explanation'>Can't read the image?
        <a href='javascript: refresh_captcha_img();'>Click here to refresh</a>.</div>
    <div class='container'>
        <input type='submit' name='Submit' value='Submit' />
    <!-- client-side Form Validations:
    Uses the excellent form validation script from>
    <script type='text/javascript'>
    // <![CDATA[
        var frmvalidator  = new Validator("contactus");
        frmvalidator.addValidation("name","req","Please provide your name");
        frmvalidator.addValidation("email","req","Please provide your email address");
        frmvalidator.addValidation("email","email","Please provide a valid email address");
        frmvalidator.addValidation("message","maxlen=2048","The message is too long!(more than 2KB!)");
        frmvalidator.addValidation("photo","file_extn=jpg;jpeg;gif;png;bmp","Upload images only. Supported file types are: jpg,gif,png,bmp");
        frmvalidator.addValidation("scaptcha","req","Please enter the code in the image above");
          = new FG_CaptchaValidator(document.forms['contactus'].scaptcha,
        function SCaptcha_Validate()
            return document.forms['contactus'].scaptcha.validator.validate();
        function refresh_captcha_img()
            var img = document.images['scaptcha_img'];
            img.src = img.src.substring(0,img.src.lastIndexOf("?")) + "?rand="+Math.random()*1000;
    // ]]>
    feedback.php is in the root folder, with all the other main webpages.

    I then have a /php folder, with
    /php/headercontact.php (a different version of my header.php file, which also loads the scripts in the /script folder, and the contact.css file)

    (among other files)

    I have an /include folder, with

    in it.

    I am fairly sure that one of my paths is wrong, and I have tried several different paths for show-captcha.php, such as:

    <div><img alt='Captcha image' src='/php/show-captcha.php?rand=1' id='scaptcha_img' /></div>

    <div><img alt='Captcha image' src='../php/show-captcha.php?rand=1' id='scaptcha_img' /></div>

    but neither of those work. Can anybody help? I expect it's something very simple. I know that ./ means 'the same directory as you are already in', and ../ means 'up a directory', but I read on a site that relative paths with multiple PHP files can get confusing (you ain't kiddin'!).


  3. #2
    bwd is offline
    Junior Member
    Join Date
    Apr 2012
    Member #
    I forgot to add the instructions that came with it:

    Installing the form____
    1. Edit the file contactform.php and update your email address.

    2. Upload the entire folder to your web site.

    3. Link to contactform.php or embed using iframe.

    I linked to /php/contactform.php, so I think that may be where the problems started? (By putting it in my /php folder.)

    EDIT: I uploaded contactform.php to the root of the site and still it didn't work, then I tried uploading show-captcha.php to the root, and it worked! And now the Feedback page version works as well!

    I would still be very interested in finding out how to link to show-captcha.php when it's in the /php folder, as shown here:

    <div><img alt='Captcha image' src='show-captcha.php?rand=1' id='scaptcha_img' /></div>

    (Line 74 of contactform.php)

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search tags for this page

contactus photo errorloc


fg captcha creator


fgcontactform captcha not working


how to get captcha in contactus form


html for contact form email with captcha

Click on a term to search for related topics.
All times are GMT -6. The time now is 11:32 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: