Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Creating a class for a comment box

$
0
0

Hi Everyone.  I am new to the world of coding in PHP and I am currently doing some practise stuff. At the moment I have a mysql database set up and I have a very basic html site. I want to place a simple comment box onto the website where someone leaves their name and their comment and it submits. Later I want to be able to log in as an administrator and manage the comments but for now I just want to create the form, create the php script and have the details stored in my database.

This is turning out to be more difficult than I thought it would be. I checked out some tutorials but I've been told not to use their code because it's either badly written or it's not done in OOP style. I have been doing some reading on OOP and the theory behind it. This is what I understand of it so please correct me if I'm wrong.

1. Objects belong to classes.

2. The classes define the objects properties and methods (functions).

3. Each object may contain different values of properties and methods but can belong to the same class.

4. Each property may have it's own methods (functions).

Is this correct?

What I would like to do is create a comment box script so users can leave comments on my site but create the script in OOP style. I'm struggling to do this because I don't know how I would first create the class. Can someone please help me and tell me how I should create the class? Thanks.

 

 


Viewing all articles
Browse latest Browse all 13200

Trending Articles