• We just launched and are currently in beta. Join us as we build and grow the community.

Feedback Form Script with Captcha Code

j0ey_

AI Personalization Expert
J Rep
0
0
0
Rep
0
J Vouches
0
0
0
Vouches
0
Posts
132
Likes
109
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
Feedback Form Script with Captcha Code

If you are looking for Feedback Form Script with Captcha Code in PHP then you are at the right place. I will teach you to step by step on how to create a feedback form with captcha code using PDO in PHP. Also, you can learn how to generate a random code and you can use this to protect your web page from random spammers. You can use this also as a type of a simple test that the response is generated by a human being and it's a very common on other websites before submitting the feedback message to their websites.

Creating Markup Feedback Form

This simple source code contains feedback form where the user can type their message, full name and email to send into the websites.

  1. <form

    class

    =

    "form-horizontal"

    style

    =

    "margin-left:360px;"

    method

    =

    "POST"

    action

    =

    "contact_query.php"

    >
  2. <h2

    >
  3. Feedback Form with Captcha
  4. </

    h2

    >
  5. <p

    class

    =

    "full_name"

    >
  6. <input

    type

    =

    "text"

    name

    =

    "full_name"

    id

    =

    "full_name"

    placeholder=

    "Enter your full name . . . ."

    autofocus=

    "autofocus"

    required/

    >
  7. <label

    for

    =

    "full_name"

    style

    =

    "color:blue; font-size:18px; font-family:cursive; margin-top:10px;"

    >

    Your Name</

    label

    >
  8. </

    p

    >

  9. <p

    class

    =

    "email"

    >
  10. <input

    type

    =

    "email"

    name

    =

    "email"

    id

    =

    "email"

    placeholder=

    "Enter your email . . . ."

    required/

    >
  11. <label

    for

    =

    "email"

    style

    =

    "color:blue; font-size:18px; font-family:cursive; margin-top:10px;"

    >

    Your Email Address</

    label

    >
  12. </

    p

    >

  13. <p

    class

    =

    "message"

    >
  14. <textarea

    name

    =

    "message"

    placeholder=

    "Enter your feedback . . . ."

    required></

    textarea

    >
  15. <label

    for

    =

    "message"

    style

    =

    "color:blue; font-size:18px; font-family:cursive; margin-top:10px;"

    >

    Your Feedback</

    label

    >
  16. </

    p

    >

  17. <div

    class

    =

    "control-group"

    style

    =

    "margin-left:-181px;"

    >
  18. <div

    class

    =

    "controls"

    >
  19. <input

    id

    =

    "code"

    name

    =

    "code_confirmation"

    type

    =

    "text"

    placeholder=

    "Enter the code above . . . ."

    required></

    td

    >
  20. </

    div

    >
  21. </

    div

    >
  22. <div

    class

    =

    "control-group"

    style

    =

    "margin-left:-181px;"

    >
  23. <div

    class

    =

    "controls"

    >
  24. <button

    type

    =

    "submit"

    name

    =

    "send_message"

    class

    =

    "btn btn-primary"

    ><i

    class

    =

    "icon-ok icon-large"

    ></

    i

    >

    Submit</

    button

    >
  25. </

    div

    >
  26. </

    div

    >

  27. </

    form

    >

Captcha Code

Creating captcha code for the confirmation before submitting their feedback message to the websites.

  1. <div

    class

    =

    "control-group"

    style

    =

    "float:left; margin-left:-185px;"

    >
  2. <div

    class

    =

    "controls"

    >

  3. <img

    src

    =

    "generatecaptcha.php?rand=<?php echo rand(); ?>

    " name="captcha_img" id='image_captcha' >
  4. <a

    href

    =

    'javascript: refreshing_Captcha();'

    ><i

    class

    =

    "icon-refresh icon-large"

    ></

    i

    ></

    a

    >
  5. <script

    language

    =

    'JavaScript'

    type

    =

    'text/javascript'

    >
  6. function refreshing_Captcha()
  7. {
  8. var img = document.images['image_captcha'];
  9. img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000;
  10. }
  11. </

    script

    >
  12. </

    div

    >
  13. </

    div

    >

Database Connection

  1. <?php

  2. $conn

    =

    new

    PDO(

    "mysql:host=localhost;dbname=feedback_form"

    ,

    'root'

    ,

    ''

    )

    ;

  3. ?>

Output

2_18.jpg


That's it, kindly click the "Download Code" button below for the full source code. Enjoy coding.

Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.


Download
You must upgrade your account or reply in the thread to view the hidden content.
 

452,496

337,656

337,664

Top