Hi, In am creating a Website, Where I am creating a Page named as save_changes.php to edit your profile.

My Logic is If user is Logged in , He will be able to see Two Links on the page Either to log out and to Edit profile.

In Edit Profile page, I have again added If User is Logged in ( Because someone can also Put on URL like XXXXXXX.com/save_changes.php ) than show Edit Profile Form , Else Show You need to Register to View the page.

As I am using Loggedin function twice, I can see Cannot redeclare loggedin()

P.S I am new to PHP Moreover my English is not so Good, Sorry for Any mistypo

    Without seeing the code in question, it may be difficult to come up with the "best" answer. The quick work-around would be to wrap your function definition within an if() block, but then you need to make sure that if() block gets executed before you ever actually need to call that function, e.g.:

    if(!function_exists('loggedin')) {
        function loggedin() {
            // function definition....
        }
    }
    

    Better would be to get your user-defined functions into a separate include file, and use require_once() to load that file (so that you don't accidentally try to load it twice).

      Write a Reply...