This is a discussion on "Comments box/guestbook php" within the PHP Forum section. This forum, and the thread "Comments box/guestbook php are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Comments box/guestbook php
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Comments box/guestbook php
I had a good look around to see if this was answered already and couldn't find anything that I understood!
I want visitors to enter a comment in a page called Comment.htm:
So what do I put in comments.php? And is Comment.htm even right? I'm not sure of this bit: form action="comments.php" Thanks for any help! |
|
|
|
#2
|
|||
|
|||
|
Re: Comments box/guestbook php
form action="comments.php" is where the user will head to after having clicked on the submit button. one thing you might want to change though is the method of retrieving the data processed, you are using the get method and for a comment you should probably(in my opinion) use the post method(just change get to post). then in comments.php put the comment value into a variable, insert it into a database or flat file and if there were no errors tell the user they have successfully created the comment and re-direct em or tell them their error, and in view.php open the flat file, get the data and post it to the screen or just simply retrieve the row data from your database and post it to the screen.
making any sense? It's kinda hard to explain less thoroughly :\ for me at least.... |
|
#3
|
||||
|
||||
|
Re: Comments box/guestbook php
Quote:
Have a look on W3Schools for PHP/MySQL beginners tutorials. It's really easy once you get the hang of it
__________________
Jack Franklin - Webforumz Moderator (x)HTML | CSS | PHP | MySQL | JQuery (Javascript) Contact: My Blog | Twitter | Delicious Want Lessons? PM me. If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#4
|
|||
|
|||
|
Re: Comments box/guestbook php
Quote:
That's exactly what I'll do this instant. Thanks for the help both of you! |
|
#5
|
|||
|
|||
|
Re: Comments box/guestbook php
Ok now I have a follow up question...
This is what I've got so far (mainly guess work/ripped off tutorials seeing as I know nothing about php!):
How do I assign a variable that I have called $new_comment to the actual new comment? In other words the visitor enters whatever comment e.g. "Hello". Then I want $new_comment = "Hello", but how do I do that? Thanks again |
|
#6
|
||||
|
||||
|
Re: Comments box/guestbook php
Assuming the new comment goes in the 1st line, you could create an array of every line in the text file and find the first line. Not sure how it's done, but I can find out for you if I am on the right lines?
__________________
Jack Franklin - Webforumz Moderator (x)HTML | CSS | PHP | MySQL | JQuery (Javascript) Contact: My Blog | Twitter | Delicious Want Lessons? PM me. If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#7
|
|||
|
|||
|
Re: Comments box/guestbook php
Hey sorry for the late reply Jack, I wasn't at home for the past few days, didn't have access to a computer etc. Anyway, it's ok, you don't have to find out if you're not sure! I'll have a poke around the internet myself for it. Thanks for the help
|
|
#8
|
||||
|
||||
|
Re: Comments box/guestbook php
Hey Idiot! :P
I have not tried this script but I've just flicked through my PHP Anthology:
__________________
Jack Franklin - Webforumz Moderator (x)HTML | CSS | PHP | MySQL | JQuery (Javascript) Contact: My Blog | Twitter | Delicious Want Lessons? PM me. If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#9
|
|||
|
|||
|
Re: Comments box/guestbook php
Sorry I never saw this...I haven't been online since June. I'd given up on this for a while but I tried your code there and it seems to work out fine. Only time will tell if it actually works when people submit some comments (haven't the page up yet).
Thanks for the help. Better late than never! |
|
#10
|
||||
|
||||
|
Re: Comments box/guestbook php
Ok kool, any probs post back.
__________________
Jack Franklin - Webforumz Moderator (x)HTML | CSS | PHP | MySQL | JQuery (Javascript) Contact: My Blog | Twitter | Delicious Want Lessons? PM me. If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New to php and need some help with a guestbook | daveclissold | PHP Forum | 4 | Mar 25th, 2007 18:15 |
| guestbook-feedback? | linn | Starting Out | 6 | Jan 8th, 2007 16:19 |
| guestbook | tell-tale heart | Web Page Design | 2 | Jun 19th, 2005 00:40 |