0

I have a form class and I want define different functions when form be submitted.

<?php

class Forms {

    function __construct() {
        if (!empty($_POST['exampleInput'])) {
            $this->PostedForms();
        }
    }

    function __call($func, $param) {

    }

    function PostedForms() {
        if (!empty($_POST['exampleInput'])) {
            if (function_exists($this->userDefined)) {
                $this->userDefined();
            }
        }
    }

}

$form = new Forms();
$form->userDefined = function ($param) {
    print_r($_POST);
}
?>

I want define userDefined function outside of class. How can I do this? Can I change any function of class after class was called? Can I change userDefined = function ($param) {print_r($_GET);} for example?

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.