I'm fairly new to PHP. I have a small issue with an application I'm working on. I have a very simple header for the application that displays on all the pages. Heres's my code for it:
Header
function writeHeader($profile) {
<a href="update_profile">Update Profile</a>
}
The purpose of the header is to direct the user to their "Update Profile" page. So the header functions just fine if the user is on the Index page (because the route is just "update_profile"). But I have several sub-pages in my app, they are structured kind of like this:
-index.phtml
-characters/create.phtml
-characters/edit.phtml
-worlds/create.phtml
-worlds/edit.phtml
-etc.
Whenever a user navigates to a page other than "Index", the link stops working because the route has changed.
I considered writing a whole new functions just to write headers specifically for these pages, but I'm wondering if there's a way to just update the function I have now to change the route if the user is navigating to the "Update Profile" page from anywhere other than Index. Can anyone give any suggestions for how to do this?