Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Email Form - Add Captcha
Old 03-05-2008, 12:40 PM Email Form - Add Captcha
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
I have a script to send emails. Can someone help me implement a captcha code validation to it. And also make 'email', 'subject', 'message' mandatory to fill in. And possibly to help me add a 'full name' field.

PHP Code:
<html>
<body>
<?php
function checkspam($field)
  {
 
  
$field=filter_var($fieldFILTER_SANITIZE_EMAIL);
 
   if(
filter_var($fieldFILTER_VALIDATE_EMAIL))
    {
    return 
TRUE;
    }
  else
    {
    return 
FALSE;
    }
  }

if (isset(
$_REQUEST['email']))
  {
//if "email" is filled out, proceed

  //check if the email address is invalid
  
$mailcheck checkspam($_REQUEST['email']);
  if (
$mailcheck==FALSE)
    {
    echo 
"Invalid input";
    }
  else
    {
//send email
    
$email $_REQUEST['email'] ; 
    
$subject $_REQUEST['subject'] ;
    
$message $_REQUEST['message'] ;
    
mail("eeeee@fffff.com""$subject",
    
$message"$email);
    echo 
"Thank you";
    }
  }
else
  {
//if "email" is not filled out, display the form
  
echo "<form method='post' action='contact.php'>
 * Email: <input name='email' type='text' /><br />
 * Subject: <input name='subject' type='text' /><br />
 * Message:<br />
  <textarea name='message' rows='10' cols='30'>
  </textarea><br />
  <input type='submit' value='Submit' />
  </form>"
;
  }
?>

</body>
</html>
Gilligan is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-06-2008, 01:47 PM Re: Email Form - Add Captcha
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
anyone?
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 03-06-2008, 04:02 PM Re: Email Form - Add Captcha
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Take a look at

http://www.encaps.net/software/php-captcha/
http://www.google.co.uk/search?q=Captcha+with+php
or
http://www.codewalkers.com/c/a/Misce...TCHA-with-PHP/

All quite useful resources
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 03-06-2008, 04:39 PM Re: Email Form - Add Captcha
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
Having problems with all of them, first one I don't want the the user to enter a specific color, and the second one doesn't tell me how to add a form.

Even if I do it, how would I make i attach to the form, and make other fields mandatory.

Sorry
Gilligan is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Email Form - Add Captcha
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13429 seconds with 12 queries