Understanding OPP

I’m trying to wrap my head around OOP.

Say I have a php file called actions which contains a few classes and functions.

I want to use a function based on user input. In my index.php can I call those functions using an anchor tag?

I’m thinking of using a button to delete an uploaded file.

thanks for you help.

You could use an objec although it would be not so different in your situation. Your form can contain this for example:

[code]

[/code]

Then on delete.php you could instantiate an example call the class

class myFileClass { public function delete($file) { return unlink($file); } }

$object = new myFileClass;
if(isset($_POST[‘filename’])) {
$object->delete($_POST[‘filename’]);
} else {
echo “An error has occurred.
”;
}

Sponsor our Newsletter | Privacy Policy | Terms of Service