Nazwa tabeli: post
id INT
title VARCHAR
content TEXT
class.post.php
<?php class Post { private $title; private $content; public function __construct() { $this->title = $this->filter($_POST['xtitle']); $this->content = $this->filter($_POST['xtext']); } public function addPost() { } public function filter($var) { } } ?>
post.php
<?php include_once('/class.post.php'); $post = new Post(); ?> <table> <tr><td>Title:</td><td><input type="text" name="xtitle"/></td></tr> <tr><td>Content:</td><td><input type="text" name="xtext"/></td></tr> </table> <input type="submit" name="dodaj" value="Dodaj"/> </form>
W przyszłości chcę stworzyć metody odpowiadające za usuwanie danych i ich edycję.
Co sądzicie o budowie tej klasy?