Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 12-30-2005, 12:19 AM
VodaHost's Avatar
General & Forum Administrator
 
Join Date: Mar 2005
Location: Wilmington, Delaware USA
Posts: 8,577
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
07092887580 / United Kingdom

Military Ranking System Explained


Click Here to take the royal VodaHost Tour
Click Here for the VodaHost Help Centre & Tutorials
Got a question? - Try a forum search! Available at the top of every page!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 01-04-2006, 06:18 PM
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 01-05-2006, 12:13 AM
VodaHost's Avatar
General & Forum Administrator
 
Join Date: Mar 2005
Location: Wilmington, Delaware USA
Posts: 8,577
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
07092887580 / United Kingdom

Military Ranking System Explained


Click Here to take the royal VodaHost Tour
Click Here for the VodaHost Help Centre & Tutorials
Got a question? - Try a forum search! Available at the top of every page!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 01-05-2006, 04:08 PM
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 02-20-2006, 12:26 AM
DXer's Avatar
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 02-20-2006, 08:54 AM
VodaHost's Avatar
General & Forum Administrator
 
Join Date: Mar 2005
Location: Wilmington, Delaware USA
Posts: 8,577
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
07092887580 / United Kingdom

Military Ranking System Explained


Click Here to take the royal VodaHost Tour
Click Here for the VodaHost Help Centre & Tutorials
Got a question? - Try a forum search! Available at the top of every page!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old 02-28-2006, 05:21 AM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old 02-28-2006, 10:15 AM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
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!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old 02-28-2006, 07:29 PM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old 02-28-2006, 07:33 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
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!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old 09-05-2007, 12:53 PM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old 09-05-2007, 05:33 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
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!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old 05-23-2008, 09:39 AM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old 05-23-2008, 09:46 AM
Private
 
Join Date: May 2008
Posts: 2
Default Re: Building a Feedback Form in PHP

someone please help me out ............
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old 05-23-2008, 10:07 AM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
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!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #