Results 1 to 19 of 19

Thread: Building a Feedback Form in PHP
      
   

  1. #1
    VodaHost's Avatar
    VodaHost is offline General & Forum Administrator
    Join Date
    Mar 2005
    Location
    Wilmington, Delaware USA
    Posts
    11,429

    Talking Building a Feedback Form in PHP

    In this tutorial we will learn how to email content collected through a form
    to a specified email address.


    I’ll assume that you know some basics HTML forms syntax. If not, don’t
    worry, you’ll quickly pick it up as we move along. Before we get started,
    make sure that your webhost supports PHP. (For those of you who are
    just picking our brains)

    Our feedback form

    We will first create the HTML page that will contain our form. Copy and
    paste the code below in your favorite text editor (e.g. Notepad), and name
    the file as feedback.html

    <html>
    <head>
    <title>Feedback Form</title>
    </head>
    <body>

    <h1> Fill in the form below to send us your comments <h1>
    <form method="post" action="feedback.php">
    Name: <input name=”name” type=”text” /><br />
    Email: <input name="email" type="text" /><br />
    Comments:<br />
    <textarea name="comments" rows="15" cols="40">
    </textarea><br />
    <input type="submit" />
    </form>

    </body>
    </html>


    If you open this file (feedback.html) in your browser, you’ll see 3 fields; a
    name, an email and a comment text field. Your visitors can fill in the form
    and once they click the ‘submit’ button, that data is sent to feedback.php
    for processing.

    You can also create your form in any WYSIWYG editor (like FrontPage,
    Dreamweaver), provided that you correctly name your form elements, and
    use the POST method along with the PHP file that will handle the content
    collected through the form. You can also add more fields accordingly.


    The feedback form PHP script

    Our next step will be to create the PHP file ‘feedback.php’, which will
    handle the data collected through the form, and email it back to you.

    So here, we go. Once again, fire up your text editor, and copy and paste
    the code below, and save the file as ‘feedback.php’:

    <?php
    $msg = "Name:t$namen";
    $msg .= "Email:t$emailn";
    $msg .= "Comments:t$commentsn";

    $recipient = "youremail@domain.com";
    $subject = "New Feedback from my site";

    $mailheaders = "From:$emailn";
    $mailheaders .= "Reply-To:$emailnn";

    mail($recipient, $subject, $msg, $mailheaders);
    header("Location:
    http://www.yoursite.com/thankyou.html");
    ?>


    When the content is send to feedback.php, the content in the text field
    “name” will be put into the variable $name. Likewise the content of email
    and comments will be put into the variable $email and $comments
    respectively.

    So if you’ve created additional fields, you can just place the dollar sign $ in
    front of the name, to declare a variable containing the content collected in
    that particular field.

    You’ll also noticed that we’ve declared another variable $msg that will make
    a copy of the different variables and this will be the body of our email. The
    t before the variable will return a tab, while the n after the variable name
    will make our move the content that follows to the next line. They basically
    just provides some formatting to our message.

    The $recipient variable will contain the email address where you want the
    data collected to be emailed, while the $subject variable will contain the
    email subject. $mailheaders is another variable that will contain the from
    email address and reply-to email address. We want a "From:" header so
    that we know who is sending the email to us and can reply to him/her if we
    need to. The From & Reply-to are set to the senders address.
    Now here
    comes the magic! mail() is a special PHP function that allows you to send
    an email with only one line of coding. In general the mail function is as
    follows:

    mail(“youremail@domain.com”, “email subject”, “the message”,
    “From:
    email@domain.com”);

    Finally, we will redirect our visitor to a ‘Thanks you’ html page, using the
    header() function in PHP. All you need to do is to create a thanks you
    page, and save it as HTML, and add the link to the header() function.
    That brings us to the end of this tutorial. You can use JavaScript to
    validate your visitor’s input and you can also extend this tutorial to create
    survey forms, or even ‘recommend a friend’ form

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  2. #2
    bkerske is offline Corporal
    Join Date
    Nov 2005
    Posts
    11

    Default Re: Building a Feedback Form in PHP

    I currently have implemented a form like this but would like to add the users name and email into an mySQL database once they hit submit. Are there any tutorials on how to do this? I've searched the forum and haven't found any yet.

  3. #3
    VodaHost's Avatar
    VodaHost is offline General & Forum Administrator
    Join Date
    Mar 2005
    Location
    Wilmington, Delaware USA
    Posts
    11,429

    Default Re: Building a Feedback Form in PHP

    No, not yet...But it's a good idea.

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  4. #4
    bkerske is offline Corporal
    Join Date
    Nov 2005
    Posts
    11

    Default Re: Building a Feedback Form in PHP

    Below are a few links that might help your tutorial. This is actually a pretty good forum for newbies. They have a complete "newbies" section that will most likely suffice most beginners wanting to do some basic data entry into a database. I will most likely be able to solve my problem using this forum but I write embedded C code for a living and have done a little PERL (enough to be dangerous). If you are not "in" software development for a living I could see where this would be a daunting task so a tutorial would probably still be nice.

    The board:
    http://phpbuilder.com/board

    The specific thread with PHP example of data entry into a mySQL database:

    http://phpbuilder.com/board/showthread.php?t=10273562

    Hope this helps someone.

  5. #5
    DXer's Avatar
    DXer is offline Private
    Join Date
    Jan 2006
    Posts
    2

    Default Re: Building a Feedback Form in PHP

    Please forgive me for being ignorant, but I dont know or understand how the above reply relkates to the form that you supply inside the web building software. if that form is useless why is it there.
    I thought that Bluevoda was suppose to be user friendly, The reply to a novice like myself for the lack of a better word is greek. I tried to open the feedback.html in my browser but get an error message sending me on a google search.
    Sorry but I have no unsderstanding of what I am told to do.
    is this somthing that I have to change within the form?

    When the content is send to feedback.php, the content in the text field
    “name” will be put into the variable $name. Likewise the content of email
    and comments will be put into the variable $email and $comments
    respectively.

    So if you’ve created additional fields, you can just place the dollar sign $ in
    front of the name, to declare a variable containing the content collected in
    that particular field.

    You’ll also noticed that we’ve declared another variable $msg that will make
    a copy of the different variables and this will be the body of our email. The
    t before the variable will return a tab, while the n after the variable name
    will make our move the content that follows to the next line. They basically
    just provides some formatting to our message.

    The $recipient variable will contain the email address where you want the
    data collected to be emailed, while the $subject variable will contain the
    email subject. $mailheaders is another variable that will contain the from
    email address and reply-to email address. We want a "From:" header so
    that we know who is sending the email to us and can reply to him/her if we
    need to. The From & Reply-to are set to the senders address.
    Now here
    comes the magic! mail() is a special PHP function that allows you to send
    an email with only one line of coding. In general the mail function is as
    follows:

    Lost
    Professor DXer

    "I know you think you heard what I said, BUT I am not sure that what you heard, is what I meant" (Listening is the key)

  6. #6
    VodaHost's Avatar
    VodaHost is offline General & Forum Administrator
    Join Date
    Mar 2005
    Location
    Wilmington, Delaware USA
    Posts
    11,429

    Default Re: Building a Feedback Form in PHP

    Your ignorance is forgiven, the above form is not a BlueVoda form and
    it never claims to be and BlueVoda is very friendly.

    Only about 40-50% of our customers use BV.The rest use FrontPage,
    dreanweaver, etc....I can not not ignore the non BV customers have

    This why I made the above post in the PHP section not the BV form
    section. If you want to build a BV form please click the below....

    http://www.vodahost.com/vodatalk/forms.html

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  7. #7
    adventurer is offline Private First Class
    Join Date
    Feb 2006
    Posts
    8

    Smile Re: Building a Feedback Form in PHP

    Does the form in BlueVoda tie into a database in anyway? Is their an easy way to do that?
    Thats all.

    es

  8. #8
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Building a Feedback Form in PHP

    No, that's a simple feedback form processing script. If you need to write or read from a database you must add a part that does this part of the work. What excactly you want to do?
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  9. #9
    adventurer is offline Private First Class
    Join Date
    Feb 2006
    Posts
    8

    Smile Re: Building a Feedback Form in PHP

    FIrst off I would like have a log in form. I've read other threads about that and can use responses to there questions. I would also like to have people submit irems for sale. Which means that I need a database that will keep record of their items along with other information such as contact info, pictures associated with that item and such.

    adventurer

  10. #10
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Building a Feedback Form in PHP

    Till you learn all that stuff you intend to, have a look at Soholaunch, that has database, querries, loggin and upload capabilities. For a ready made script look at Fantastico, Noah's Classifieds
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  11. #11
    pratik koney is offline Private
    Join Date
    Sep 2007
    Posts
    1

    Default Re: Building a Feedback Form in PHP

    Quote Originally Posted by VodaHost View Post
    In this tutorial we will learn how to email content collected through a form
    to a specified email address.

    I’ll assume that you know some basics HTML forms syntax. If not, don’t
    worry, you’ll quickly pick it up as we move along. Before we get started,
    make sure that your webhost supports PHP. (For those of you who are
    just picking our brains)

    Our feedback form

    We will first create the HTML page that will contain our form. Copy and
    paste the code below in your favorite text editor (e.g. Notepad), and name
    the file as feedback.html

    <html>
    <head>
    <title>Feedback Form</title>
    </head>
    <body>
    <h1> Fill in the form below to send us your comments <h1>
    <form method="post" action="feedback.php">
    Name: <input name=”name” type=”text” /><br />
    Email: <input name="email" type="text" /><br />
    Comments:<br />
    <textarea name="comments" rows="15" cols="40">
    </textarea><br />
    <input type="submit" />
    </form>
    </body>
    </html>

    If you open this file (feedback.html) in your browser, you’ll see 3 fields; a
    name, an email and a comment text field. Your visitors can fill in the form
    and once they click the ‘submit’ button, that data is sent to feedback.php
    for processing.

    You can also create your form in any WYSIWYG editor (like FrontPage,
    Dreamweaver), provided that you correctly name your form elements, and
    use the POST method along with the PHP file that will handle the content
    collected through the form. You can also add more fields accordingly.

    The feedback form PHP script

    Our next step will be to create the PHP file ‘feedback.php’, which will
    handle the data collected through the form, and email it back to you.
    So here, we go. Once again, fire up your text editor, and copy and paste
    the code below, and save the file as ‘feedback.php’:

    <?php
    $msg = "Name:t$namen";
    $msg .= "Email:t$emailn";
    $msg .= "Comments:t$commentsn";
    $recipient = "youremail@domain.com";
    $subject = "New Feedback from my site";
    $mailheaders = "From:$emailn";
    $mailheaders .= "Reply-To:$emailnn";
    mail($recipient, $subject, $msg, $mailheaders);
    header("Location: http://www.yoursite.com/thankyou.html");
    ?>

    When the content is send to feedback.php, the content in the text field
    “name” will be put into the variable $name. Likewise the content of email
    and comments will be put into the variable $email and $comments
    respectively.

    So if you’ve created additional fields, you can just place the dollar sign $ in
    front of the name, to declare a variable containing the content collected in
    that particular field.

    You’ll also noticed that we’ve declared another variable $msg that will make
    a copy of the different variables and this will be the body of our email. The
    t before the variable will return a tab, while the n after the variable name
    will make our move the content that follows to the next line. They basically
    just provides some formatting to our message.

    The $recipient variable will contain the email address where you want the
    data collected to be emailed, while the $subject variable will contain the
    email subject. $mailheaders is another variable that will contain the from
    email address and reply-to email address. We want a "From:" header so
    that we know who is sending the email to us and can reply to him/her if we
    need to. The From & Reply-to are set to the senders address. Now here
    comes the magic! mail() is a special PHP function that allows you to send
    an email with only one line of coding. In general the mail function is as
    follows:

    mail(“youremail@domain.com”, “email subject”, “the message”,
    “From: email@domain.com”);

    Finally, we will redirect our visitor to a ‘Thanks you’ html page, using the
    header() function in PHP. All you need to do is to create a thanks you
    page, and save it as HTML, and add the link to the header() function.
    That brings us to the end of this tutorial. You can use JavaScript to
    validate your visitor’s input and you can also extend this tutorial to create
    survey forms, or even ‘recommend a friend’ form
    dear friend

    i did the code you gave and everything was fine i can go to thank you page and no errors but i cannot receive any emails from the feedback form. in email@domain.com i have put my email address but no email. why is that.please helpme

  12. #12
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Building a Feedback Form in PHP

    Ok, these are the VERY old tutorials (i don't even understand where you have found them) that explained how to hand code a form and the thank you page.

    there is no need to do so, because now BlueVoda has a built in form builder, and the php part for the thank you page is also much easier. Please watch BlueVoda Form Tutorial 1 , and MOST IMPORTANT, read the text UNDER the multimedia tutorial.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  13. #13
    alienz is offline Private
    Join Date
    May 2008
    Posts
    2

    Default Re: Building a Feedback Form in PHP

    hi admin
    i have used the feedback form script as given here. but what i get in my email is these three words - name:temail:tcomment:t

    whats wrong?????? my site is loaded and others are waiting for the feedback form

  14. #14
    alienz is offline Private
    Join Date
    May 2008
    Posts
    2

    Default Re: Building a Feedback Form in PHP

    someone please help me out ............

  15. #15
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Building a Feedback Form in PHP

    Please provide a link to your form page, we just can see through walls...

    And, as i said, do NOT follow the instruction above.

    If you are a VodaHost client and a BlueVoda user, please watch these tutorials:

    BlueVoda Forms Tutorial Part 1

    Form Wizard Tutorial
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  16. #16
    thompsonay is offline Private
    Join Date
    Oct 2008
    Posts
    1

    Default Re: Building a Feedback Form in PHP

    I implemented this form and it works! When i say that it works, the issues that i have had as a beginner with this form has been solved; however, i did not receive back the information to my email. any suggestions?

  17. #17
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: Building a Feedback Form in PHP

    Please post a link to your form and if you use BV why not use the form wizard...........

  18. #18
    Cpt Random is offline Private
    Join Date
    Mar 2009
    Posts
    2

    Cool Re: Building a Feedback Form in PHP

    worked on my ******* server but not on my clients private server. any thoughts? do you have to have certain software installed to use php on a server?

  19. #19
    Cpt Random is offline Private
    Join Date
    Mar 2009
    Posts
    2

    Default Re: Building a Feedback Form in PHP

    go ***** server... thats weird..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49