Log in

View Full Version : comment box code needed



Adler80
09-27-2008, 03:48 PM
I need some help to make a comment box in some pages in my website. basically just a link on which visitors can click and opens a box in the same page and shows the comment in the same page after submission. I know I need to use PHP or ASP for database part and maybe some Javascript or simple HTML for creating the form, but as you see am relatively new in this area so any kind of help would be greatly applreciated.

looking forward to your wicked replies

Adler

Goodman343
09-29-2008, 05:48 PM
Hi Alder80,

There are some great websites that have "Form Generator" scripts, they usually come in 2 pieces.

1. The HTML/XHTML portion is inserted directly into your website, to place the form.

2. The rest of the code is placed on your server in a .php/.asp or other file.

If you need custom forms, you may need to find further assistance.

You can check out my "contact" form here:

-> http://home-job-reviews.com - Just click the button that says "Contact".

AND, you can get a form like this made for you here:

-> http://www.thesitewizard.com/wizards/feedbackform.shtml

That's the script generator. Tried a few others but they were not as good.

Jon101
09-29-2008, 06:37 PM
you can try a site like: http://www.gentlesource.com/comment-script/

or just google "Free php comment box" or something like that.

Good luck!

Adler80
09-29-2008, 10:14 PM
you guys are swesome, thanks. But apparently I need to use ASP since my web server is running on Windows, any suggestion on how I'm supposed to change my PHP coding to ASP?
Thanks

Goodman343
09-30-2008, 04:34 AM
Hello Again Adler80,

Here's a helpful website, they offer both .php and .asp form creation.

-> http://www.tele-pro.co.uk/scripts/contact_form/

I would suggest that you:

1. Plug-in the HTML form code.

2. copy and paste from the "frames" that appear with the form code then, create your own text file for the server-side "contact.asp" file.

3. Set your redirect URL's to the proper webpages.

4. Test your work.

Goodluck!

Adler80
09-30-2008, 09:50 AM
you really are a good man, Goodman343 ;)

I did try it, everything looks to be fine, apart from after submitting the form, I don't know where the information goes!!! am I supposed to receive an email or what? Anyway, I can send the information to MySQL database in my web host?

Goodman343
09-30-2008, 04:22 PM
Hi Alder80,

It sounds like you have the form in place, but there may be some changes you need to make:

1. The "To Email" - This is the place where your messages are sent, you need to change this to the email inbox you want to get your messages sent to.

EmailTo = Trim(Request.Form("EmailTo"))

All you need to do is open your contact.asp file and change the bolded segment to the desired email address, everything else is a user entered variable that is gathered from the web form. Your finished code should look simular to this:

EmailTo = "MY EMAIL ADDRESS"

2. Then, simply make sure that these lines of code are "Redirecting" to the correct page, as to indicate success or failure of your script:

-> If (validationOK=false) Then Response.Redirect( "error.htm?" & EmailFrom)

-> Response.Redirect( "ok.htm?" & EmailFrom)

That should be it. Providing an easy and private way for your visitors to provide you feedback is very important. When creating the comment page why not provide a contact form, a mailto: URL, and your email address. That way the visitor can pick their preferred method(Although I am sure 90% of them will just use the form).

sohaibshaheen
02-12-2009, 06:42 PM
hi guys,

Comment boxes are most frequently codes on webpages that you can see on almost all sites but unfortunately the databases are often not present e.g. for free users and some admins are often reluctant to use databases and experiment with them...

So I have created a code that uses text file and which is extremely easy to install even a novice can install it...

1. Create a directory on your server e.g. http://www.example.com/comment

2. copy the attached files (comment.txt and comment.php) in this directory ..

3. make comment.txt writtable (chmod 777) ...

and you are done..

YOu may change the name of php file to anything else e.g. comment.php to index.php without effecting code...

whole the code is in one file (form and php ) so you need to take your visitors to comment.php page only....

(if you are aware of php then you can use include('comment.php'); in your php page )
Enjoy.... :cool:

sohaibshaheen
02-12-2009, 06:43 PM
forgot to mention (screenshot available in zip file)....

also comments are dislayed below comment box....

sohaibshaheen
01-03-2010, 08:03 PM
to email the comments to your mailing address you may refer to this blog.Its simple and fully illustrated.

http://php-clan.blogspot.com/2009/12/comment-box-in-php-email-comments-to.html

pam5
02-21-2010, 04:33 PM
where i have to upload php file on server?

djr33
02-21-2010, 05:30 PM
That's a vague question and easily answered by an understanding of how PHP works in general.

A .php page is exactly the same as a .htm page except that it runs through the php parser before being sent from the server and anything within <?php PHP CODE HERE ?> gets processed as php, INTO html, then sent out.

In other words, you need to place the php in the html page you want to use it in. For a form, the form's action points it to a page (just like a link) and that "action" page will receive the information. This needs to match where your php page is located, but beyond that it can be anywhere you'd like.