OOP design question
| From: | Mike Smith | Date: | Mon, 05 Jan 2004 16:01:08 +0000 |
| Subject: | OOP design question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-173763@lists.php.net to get a copy of this message | ||
I am starting to get a handle (I think) on OOP. I was wondering if anyone would care to comment on what I think I understand:
For simplicity's sake class.php contains AddItem() and DisplayItems(). Since submitting form data
<?php
include('class.php');
If(!$_POST['submit']){ //Do I need to instantiate(?) $po everytime the page reloads?
$po = new PO;
}
If($_POST['submit']){
$po->AddItem();
}
<form action="$PHP_SELF" method="POST" >
...form fields and a submit button...
</form>
$po->DisplayItems();
?>
Is this a good basic methodology (aside from checking the form fields for valid characters).
Thanks,
Mike Smith