Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 38
  1. #1
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    newbie - help with recaptcha

    I have a recapture form in php. And I have a form, I have tried to integrate the two but I have no idea. This is the code I have, am I doing anything wrong? I cant see how the form would be sent via email.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <title>Volunteering Form</title>
    <link href="styles/layout.css" rel="stylesheet" type="text/css" />
    <link href="styles/mainstyle.css" rel="stylesheet" type="text/css" />
    <link href="styles/form.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="container">
    <div id="header">
    <div id="left_header"><h1 id="logo"><a href=" title="Lee Oasis Furniture Project"><em title="Lee Oasis Home Page"></em>Lee Oasis Furniture Project</a></h1>
    </div><!--left_header-->
    <div id="right_header">
    <p class="logtitle">Recycle and donate<br />unwanted furniture<br/>Tel: 020 8857 
    0043<br /><span class="caps">Lewisham Area</span></p></div><!--right_header-->
    </div><!--header-->
    <div class="clear"></div><!--clear-->
    <div id="nav">
    <ul>
    <li><a href="../index.html">Home</a></li>
    <li><a href="../about.html">About Us</a></li>
    <li><a href="../dropin.html">Drop-in</a></li>
    <li><a href="../furniture.html">Furniture Project</a></li>
    <li class="current"><a href="../volunteer.html">Volunteer</a></li>
    <li><a href="../news.html">News/Events</a></li>
    <li id="last"><a href="../appeals.html">Appeals</a></li>
    </ul>
    </div><!--nav-->
    <div class="textbox_outer">
    <div class="textbox_inner">
    <h2>Volunteer</h2>
    <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
    <div id="form">
    <form action="mailto:" method="POST" enctype="multipart/form-data" name="form_to_email">
    <p><label>Your Name:</label><br />
    <input type="text" size="20" name="name" /><br />
    <label>Your Address:</label><br />
    <textarea name="address" rows="5" cols="20">
    </textarea><br /></p>
    <p><label>Telephone:</label><br />
    <input type="text" size="20" name="telephone" /><br /><br />
    <label>Email:</label><br />
    <input type="text" size="20" name="email" /><br /><br />
    <label>What would you like to do/skills offered:</label><br />
    <textarea name="skills" rows="5" cols="20">
    </textarea></p>
    <p>How much time do you have available?<br />
    <label>Hours per week/month?</label><br /> 
    <input type="text" size="20" name="time" /><br /><br />
    <label>On Occassional Basis?</label><br />
    <input type="text" size="20" name="occassional" /></p>
    <p>I understand the general policy of Lee Oasis and agree with its aims and 
    ethos. I have also read the relevant Health and Safety and/or Child Protection 
    Policy as it applies to me; and agree to abide by it.</p>
    <p><label>Signed (Add name and submit form):</label>
    <input type="text" size="20" name="signed" /><br /><br />
    <label>Date:</label><br/>
    <input type="text" size="20" name="date" /><br /><br />
    <input type="submit" value="email_form" /></p>
    </form>
          <form method="post" action="../php/verify.php">
            <?php
              require_once('recaptchalib.php');
              $publickey = "(removed for this post) "; // you got this from the signup page
              echo recaptcha_get_html($publickey);
            ?>
    <script type="text/javascript">
    var RecaptchaOptions = {
        theme : 'clean'
     };
     </script>
    <input type="submit" />
    </form>
    </div><!--textbox_inner-->
    </div><!--textbox_outer-->
    <div class="clear"></div><!--cleardiv-->
    <div id="footer">
    <p></p>
    </div><!--footer-->
    </div><!--container-->
    </body>
    </html>
    I know it is a mess where do I begin, I have read all the documentation but it is not very helpful to me. This is a php page, and it is not even showing my styles.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    wow ... that is a mess (trying hard not to lol on you).

    ReCaptcha doesn't process and send forms. It only checks for the proper code.

    Here is what I suggest ...

    Start over.

    1) Create your contact page with the form. Just the contact page and the form.
    Don't worry about the Recaptcha yet.

    2) Create the PHP script that processes the form. Make that a separate script.
    Right now you have form action="mailto:" . You will need
    a PHP script to process your contact form. I'm not sure if you have that yet?
    Don't combine the form with the script that processes it, make it separate.
    Again, don't worry about the Recaptcha yet.

    3) Get your form working, and the PHP script working. So when you fill out the
    form, it successfully emails it. Make it all look and work the way you want.
    Leave some room at the bottom of your form for the "future Recaptcha" ...

    THEN, .... THEN, you can insert Recaptcha. When you get to that point,
    give us the link to your form, and list your PHP script that processes the form.
    It will be easier to insert Recaptcha at that time.
    Last edited by mlseim; 12-12-2010 at 02:38 AM.

  • #3
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    OK I will get on with creating the form and getting it to work without the captcha, but where would I get some code to process the form?

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    The script below is from another post.
    You will use the variable names from your contact form,
    and your own email address.

    PHP Code:
    <?php  

    // This is a super basic mail form without any  
    // validation, captcha, or checking of any kind.  

    // Get variables from your form ...  
    $firstname $_POST['Fname'];  
    $lastname $_POST['Lname'];  
    $usercity $_POST['UseCity'];  
    $usercountry $_POST['UserCountry'];  
    $useremail $_POST['userEmail'];  
    $username $_POST['Username'];  
    $userpassword $_POST['Userpassword'];  
    $fmessage $_POST['Message'];  

    // Who the form gets sent to ...  
    $recipient "youremail@hotmail.com";  
    $subject "Your Webpage Contact Form";  

    // Where to go after the user submits the form ...  
    $redirect "index.html";  

    $message "  
    ================================  
    Name:  $firstname $lastname 
    User: $username 
    Email:  $useremail  
    -----------------------------------------  
    $fmessage
    ================================  
    "
    ;  

    $extraheaders "From: $useremail\n\nReply-To: $useremail\n\n";  

    if (! 
    mail($recipient$subject$message$extraheaders))  
      echo 
    "Mail did not send for some reason.";  

    header("Location: ".$redirect);  

    ?>

  • #5
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    Thanks for posting this script but what do I do with it?
    Code:
    <?php  
    
    // This is a super basic mail form without any // validation, captcha, or checking of any kind.  
    
    // Get variables from your form ...  
    $firstname = $_POST['Fname'];
    $lastname = $_POST['Lname'];
    $usercity = $_POST['UseCity'];
    $usercountry = $_POST['UserCountry'];
    $useremail = $_POST['userEmail'];
    $username = $_POST['Username'];
    $userpassword = $_POST['Userpassword']; $fmessage = $_POST['Message'];  
    
    // Who the form gets sent to ...  
    $recipient = "myemail";
    $subject = "Volunteering Form.html";  
    
    // Where to go after the user submits the form ...  
    $redirect = "thanks.html";  
    
    $message = "  
    ================================
    Name:  $firstname $lastname
    User: $username
    Email:  $useremail
    -----------------------------------------
    $fmessage
    ================================
    ";  
    
    $extraheaders = "From: $useremail\n\nReply-To: $useremail\n\n";  
    
    if (! mail($recipient, $subject, $message, $extraheaders))
      echo "Mail did not send for some reason.";  
    
    header("Location: ".$redirect);  
    
    ?>
    What I mean is how do I call it on the volunteering form. I have this right now, <form action="mailto:" method="POST" enctype="multipart/form-data" name="form_to_email"> I have called this php above process.php so how do I call it?

    thanks

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    <form action="process.php" method="POST" enctype="multipart/form-data" name="form_to_email">

    Then, you have to look at your <form> variable names ... eg. name="Email",
    and make them the same in "process.php" as in your <form>

    Using Google to find some "php contact form tutorials" might be beneficial.

  • #7
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    How will I know what the variables are until the form is filled in? OK I understand that will take me some time, I have looked for php forms but I dont know if google has any that I can find.

  • #8
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    thanks for helping me, but for the variables should I add user to them all?

    $username = $_POST['name'];

    I just have 'name' as the named field and not username

  • #9
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    I now have this: Is it correct?

    PHP Code:
    <?php  

    // This is a super basic mail form without any // validation, captcha, or checking of any kind.  

    // Get variables from your form ...  
    $username $_POST['name'];
    $useraddress $_POST['address'];
    $useremail $_POST['email'];
    $usertelephone $_POST['telephone'];
    $userskills $_POST['skills'];
    $usertime $_POST['time'];
    $useroccassional $_POST['occassional'];  
    $usersignature $_POST['signature'];
    $userdate $_POST['date'];

    // Who the form gets sent to ...  
    $recipient "my email address";
    $subject "Volunteering Form";  

    // Where to go after the user submits the form ...  
    $redirect "thanks.html";  

    $message "Thank-you for your completed form, you will hear from us soon. 
    ================================
    Name:  $name
    Email:  $useremail
    -----------------------------------------
    $fmessage
    ================================
    "
    ;  

    $extraheaders "From: $useremail\n\nReply-To: $useremail\n\n";  

    if (! 
    mail($recipient$subject$message$extraheaders))
      echo 
    "Mail did not send for some reason.";  

    header("Location: ".$redirect);  

    ?>

  • #10
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I don't know ... try it.

    Put your real email address in this line:
    $recipient = "my email address";

    and see if you get an email when you submit the form.

  • #11
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    The form did produce an email, but the form is not recognising my thanks.html page. It think that the thanks.html should be in the php_files folder. So how can I make the below into a php page?
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Language" content="en-gb" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <title>Volunteering Form</title>
    <link href="styles/layout.css" rel="stylesheet" type="text/css" />
    <link href="styles/mainstyle.css" rel="stylesheet" type="text/css" />
    <link href="styles/form.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="container">
    <div id="header">
    <div id="left_header"><h1 id="logo"><a href=" title="Lee Oasis Furniture Project"><em title="Lee Oasis Home Page"></em>Lee Oasis Furniture Project</a></h1>
    </div><!--left_header-->
    <div id="right_header">
    <p class="logtitle">Recycle and donate<br />unwanted furniture<br/>Tel: 020 8857 
    0043<br /><span class="caps">Lewisham Area</span></p></div><!--right_header-->
    </div><!--header-->
    <div class="clear"></div><!--clear-->
    <div id="nav"><a id="top"></a>
    <ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="about.html">About Us</a></li>
    <li><a href="dropin.html">Drop-in</a></li>
    <li><a href="furniture.html">Furniture Project</a></li>
    <li class="current"><a href="volunteer.html">Volunteer</a></li>
    <li><a href="news.html">News/Events</a></li>
    <li id="last"><a href="appeals.html">Appeals</a></li>
    </ul>
    </div><!--nav-->
    <div class="textbox_outer">
    <div class="textbox_inner">
    <h2>Volunteering Form</h2>
    <p>Thank you for your interest and completion of form, you will hear from us soon.</p><br /><br />
    <p><img alt="arrow left icon image" height="11" src="images/arrow_left.jpg" width="14" />
    <a href="volunteer.html">Back</a> to volunteer page</p>
    <div class="empty"></div>
    </div><!--textbox_inner-->
    </div><!--textbox_outer-->
    <div class="clear"></div><!--cleardiv-->
    <div id="footer"><p><br /><span class="smaller">Registered Charity No. </span></p></div><!--footer-->
    </div><!--container-->
    </body>
    </html>
    DO I just add <?php to the beginning of the page?

  • #12
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Your "thanks.html" file is just a webpage you make that says "thank you".
    It can be located anywhere, you just have to provide the path to it here ...

    // Where to go after the user submits the form ...
    $redirect = "thanks.html";

    What is the link to your "thanks.html" page?

    When everything works perfectly, you get the email you want,
    the thanks page works, everything looks good ... let me know.

    Then, post your contact form and your process.php form once again.
    It's at that point where we will be adding the captcha portion.

  • #13
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    Silly me, of course it would recognise the path name. It goes to thanks.html now.

    I have another problem though the form is not picking up the workhours field. DO you know why?

    Code:
    <?php  
    
    // This is a super basic mail form without any // validation, captcha, or checking of any kind.  
    
    // Get variables from your form ...  
    $username = $_POST['name'];
    $useraddress = $_POST['address'];                 
    $useremail = $_POST['email'];
    $usertelephone = $_POST['telephone'];
    $userskills = $_POST['skills'];
    $userworkhours = $_POST['workhours'];
    $useroccassional = $_POST['occassional'];  
    $usersigned = $_POST['signed'];
    $userdate = $_POST['date'];
    
    // Who the form gets sent to ...  
    $recipient = "<E-mail Removed as User\'s Request>";
    $subject = "Volunteering Form";  
    
    // Where to go after the user submits the form ...  
    $redirect = "../thanks.html";  
    
    $message = "
    ================================
    Name:  $username
    Address: $useraddress
    Email:  $useremail
    Telephone: $usertelephone
    Skills: $userskills
    Workhours: $userworkhours
    Occassional: $useroccassional
    Signed: $usersigned
    Todaydate: $userdate
    
    -----------------------------------------
    $fmessage
    ================================
    ";  
    
    $extraheaders = "From: $useremail\n\nReply-To: $useremail\n\n";  
    
    if (! mail($recipient, $subject, $message, $extraheaders))
      echo "Mail did not send for some reason.";  
    
    header("Location: ".$redirect);  
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>Volunteer Form Process</title>
    </head>
    
    <body>
    
    </body>
    
    </html>
    Last edited by ShaneC; 01-24-2011 at 04:23 PM. Reason: E-mail removed at user's request

  • #14
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,495
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Look at your form:

    <p>How much time do you have available?<br />
    <label>Hours per week/month?</label><br />
    <input type="text" size="20" name="time" /><br /><br />

    I don't see "workhours" anywhere on your form.

  • #15
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    Will time work? as I changed time to workhours, because 'time' - was showing up as green in the php editor, so there must be something wrong with 'time'. Wht od you think?


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

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