Welcome Guest, Not a member yet? Register   Sign In
function overloading???
#1

[eluser]jigen7[/eluser]
hi everybody is there a way a function can be used as a 2 function??what i mean is that if there is no $_POST variable it will load a certain page if there is it will call a model function??
Code:
function try()
        {
        if ($_POST){
        call model}
        else{
        $this->load->view('user_try');
        }
#2

[eluser]simonspoken[/eluser]
From what I understand, you want something like this:

Code:
function newTry() { // try is already a function name - php.net/try
     if (!empty($_POST)){ // POST is an array, so check to see if any data has been stored in it
         // call model
     } else {
         $this->load->view('user_try');
     }
}
#3

[eluser]jigen7[/eluser]
somehow i messed up from my last code thx by the way
#4

[eluser]ejangi[/eluser]
This thread might also be useful.




Theme © iAndrew 2016 - Forum software by © MyBB