Skip navigation
Currently Being Moderated

Captcha image not working

May 6, 2012 10:35 AM

Tags: #cs5 #php #html #dreamweaver

Here is the link to my contact form page:  http://www.healthquestpt.com/hpc/contact.html  The captcha image isnt working and the form doesnt work.  This image is in the directory "scripts/images"

 

These are the options I've tried so far:

 

<?php $random = rand(0,3); ?>

<img src="images/img_<?php echo $random; ?>.jpg"/><br />

<input type="hidden" name="captcha_code" value="<?php echo $random; ?>" />

 

<?php $random = rand(0,3); ?>

<img src="scripts/images/img_<?php echo $random; ?>.jpg"/><br />

<input type="hidden" name="captcha_code" value="<?php echo $random; ?>" />

 

<?php $random = rand(0,3); ?>

<img src="/scripts/images/img_<?php echo $random; ?>.jpg"/><br />

<input type="hidden" name="captcha_code" value="<?php echo $random; ?>" />

 

I've tried moving the images from the "scripts/images" to the "images" file in the main directory.

I've tried moving the contact.html into the "scripts" file

I've tried moving the formmailer.php into the main directory.

 

None of the above work so  right now I have the contact.html in the main directory, the formmailer.php & images associated with formmailer in the "scripts" file and another set of the images in the "images" file in the main directory.

 

here is the link to the "scripts" folder:  http://www.healthquestpt.com/hpc/scripts/

 

 

Please help.

 
Replies
  • Currently Being Moderated
    May 6, 2012 11:19 AM   in reply to BcSurvivor08

    IMO, Captchas are the single worst thing you can do to your contact forms.  They pose many usability problems and actually kill conversion rates because they are so hard to decipher.   If you can avoid it, don't use Captchas.

     

    There are better ways to trap spam bots without punishing site visitors.  My personal favorite is the hidden field (aka honeypot) method.    Hidden fields work because spam bots are stupid.  They don't see CSS and they are compelled to fill-in every form field they encounter.  If the hidden field contains data, the PHP script flags it as spam and doesn't execute the script. 

     

    I use a hidden field on all my contact forms and have not had any problems with robot spam on any of my sites. It works!

     

     

    Nancy O.

    Alt-Web Design & Publishing

    Web | Graphics | Print | Media  Specialists 

    http://alt-web.com/

    http://twitter.com/altweb

    http://alt-web.blogspot.com/

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 2:11 PM   in reply to BcSurvivor08

    Before we chase form processing issues, let's get your code cleaned up.  You have too many validation errors for my comfort.

    http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.healthque stpt.com%2Fhpc%2Fcontact.html

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 3:13 PM   in reply to BcSurvivor08

    You're missing the <ul> tags.  Change this:

     

    <div class="topnav" style="width: 280px; float: left; position: relative; z-index: 10 !important; margin-left: 88px;">


    <li><a href="index.html">Home</a></li>    

    <li><a href="about.html">About Us</a></li> 

    <li><a href="services.html">Our Services</a></li>


      
    </div>

     

    to this:

     

    <div class="topnav" style="width: 280px; float: left; position: relative; z-index: 10 !important; margin-left: 88px;">

    <ul>
    <li><a href="index.html">Home</a></li>    

    <li><a href="about.html">About Us</a></li> 

    <li><a href="services.html">Our Services</a></li>

    </ul>
    </div>

     

    Also change this:

     

    <div class="sidenav">

    <li><a href="services.html">Our Services</a></li>

    <li><a href="purpose.html">Our Purpose</a></li>

    <li><a href="bios.html">Management Bio's</a></li>

    <li><a href="privacy.html">Privacy Policy</a></li>

    <li><a href="careers.html">Career Opportunities</a></li>

    <li><a href="contact.html">Contact Us</a></li>

    </div>

     

    to this:

     

    <div class="sidenav">

    <ul>

    <li><a href="services.html">Our Services</a></li>

    <li><a href="purpose.html">Our Purpose</a></li>

    <li><a href="bios.html">Management Bio's</a></li>

    <li><a href="privacy.html">Privacy Policy</a></li>

    <li><a href="careers.html">Career Opportunities</a></li>

    <li><a href="contact.html">Contact Us</a></li>

    </ul>

    </div>

     

     

    Can you post your PHP code?

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 3:54 PM   in reply to BcSurvivor08

    Nevertheless, I need you to make those changes and upload the page.  We can tweak your CSS after your markup is detangled.

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 4:04 PM   in reply to BcSurvivor08

    OK.  Now add this to your CSS:

     

    ul {margin:0; padding:0}

     

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 4:11 PM   in reply to Nancy O.

    Where is your formmailer.php script now?  I'm getting a 404 error from this location

    http://www.healthquestpt.com/hpc/scripts/

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 4:20 PM   in reply to BcSurvivor08

    The path to your script is not correct.  Where exactly is your PHP script on the server?  The form itself needs a correct path or it won't be able to find the script.

     

    <form id="form" method="post" action="formmailer.php" enctype="multipart/form-data">

     

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 4:52 PM   in reply to BcSurvivor08

    OK.  Keep the script in your root folder.  Discard the one from Scripts folder.

     

    Use this path on the action attribute:

     

    <form id="form" method="post" action="formmailer.php" enctype="multipart/form-data">

     

    Also change this:

     

    <div style="margin-left:25px;"><label>Name*</label>

    <input name="Name" id="name" type="text" size="20" tabindex="1" /></div><br />

     

    to this (PHP is cAsE sEnSiTiVe):

     

    <div style="margin-left:25px;"><label>Name*</label>

    <input name="Name" id="Name" type="text" size="20" tabindex="1" /></div><br />

     

    Ensure that the rest of your form input fields have the same ID and Labels to match your PHP script.

     

    Name, Address, City, State, Zip, Email, Phone, Comments.

     

    It should work!

     

     

    Nancy O.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points