Register

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
    bwd is offline
    Junior Member
    Join Date
    Apr 2012
    Posts
    14
    Member #
    31442
    Hi, I am using this PHP form on a site I am doing for a friend:

    http://www.html-form-guide.com/conta...-tutorial.html

    You can view their demo of the form here:

    http://www.html-form-guide.com/files...ontactform.php

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

    http://www.donkeyote.com/feedback.php

    The
    show-captcha.php
    file isn't loading, according to Firebug.

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

    Code:
    <?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 -->
     
    </div>
    <!-- END OF MAINCONTENT -->
    
    </div>
    <!-- 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:

    Code:
    <?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:
        http://www.html-form-guide.com/contact-form/php-contact-form-tutorial.html
    */
    require_once("./include/fgcontactform.php");
    require_once("./include/captcha-creator.php");
    
    $formproc = new FGContactForm();
    $captcha = new FGCaptchaCreator('scaptcha');
    
    $formproc->EnableCaptcha($captcha);
    
    //1. Add your email address here.
    //You can add more than one receipients.
    $formproc->AddRecipient('mynwood@btinternet.com'); //<<---Put your email address here
     
    //2. For better security. Get a random tring from this link: http://tinyurl.com/randstr
    // and put it here
    $formproc->SetFormRandomKey('skedbmPDKpvnvxL');
    
    $formproc->AddFileUploadField('photo','jpg,jpeg,gif,png,bmp',2024);
    
    if(isset($_POST['submitted']))
    {
      if($formproc->ProcessForm())
      {
            $formproc->RedirectToURL("thank-you.php");
      }
    }
    
    ?>
      
    <!-- Form Code Start -->
    <form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'
    enctype="multipart/form-data">
    
    <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>
    <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>
    <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>
    <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>
    <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>
     
    <div class='container'>
        <input type='submit' name='Submit' value='Submit' />
    </div>
    
    </fieldset>
    </form>
    <!-- client-side Form Validations:
    Uses the excellent form validation script from JavaScript-coder.com-->
    
    <script type='text/javascript'>
    // <![CDATA[
    
        var frmvalidator  = new Validator("contactus");
        frmvalidator.EnableOnPageErrorDisplay();
        frmvalidator.EnableMsgsTogether();
        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");
    
        document.forms['contactus'].scaptcha.validator
          = new FG_CaptchaValidator(document.forms['contactus'].scaptcha,
                        document.images['scaptcha_img']);
    
        function SCaptcha_Validate()
        {
            return document.forms['contactus'].scaptcha.validator.validate();
        }
    
        frmvalidator.setAddnlValidationFunction("SCaptcha_Validate");
    
        function refresh_captcha_img()
        {
            var img = document.images['scaptcha_img'];
            img.src = img.src.substring(0,img.src.lastIndexOf("?")) + "?rand="+Math.random()*1000;
        }
    
    // ]]>
    </script>
    feedback.php is in the root folder, with all the other main webpages.

    I then have a /php folder, with
    /php/contactform.php
    /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)
    /php/show-captcha.php

    (among other files)

    I have an /include folder, with
    /include/captcha-creator.php
    /include/class.phpmailer.php
    /include/fg.contactform.php
    /include/Readme.txt
    /include/SFOldRepublicSCBold.ttf

    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'!).

  2.  

  3. #2
    bwd
    bwd is offline
    Junior Member
    Join Date
    Apr 2012
    Posts
    14
    Member #
    31442
    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.
    see: http://www.html-form-guide.com/conta...tact-form.html

    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 12:57 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com