I am making a website that needs to have a profile system.
Currently i have it setup so you go to /profile/namehere
and the profile will show with the information dynamically, BUT ofcourse you have to manually copy paste these profiles and change the name for them to work.
I want it so that when a form is submitted in this case you enter name and press submit they are added to the database which I already have done myself and a profile is automatically made.
I have researched this a little and come up with the fact that I need to make a controller or profile template that will call the information into, but i have already sort of done this, it is just i am unsure and cannot find any documentation online of how to do it specifically with /profile/namehere/
Any help would be extremely appreciated or code examples, thanks so much!
The database i am using is MYSQL although i will be migrating to PDO when i get round to it, but the profiles for now can be in MYSQL. my current page code looks something like this:
Title and meta tags are shown via config file / api.
Page content is echoed for the things being selected from database i am using $row['var'];
with the select
statement to access database.
At this current state a profile is copied and pasted with the name changed to the users name and that is the profile done, i want it so when you submit form to make users name it will automatically create the profile which can be accessed at /profile/namehere/
rather than manual creation.
Conclusion
Essentially, - Form submitted - User visits /profile/name - Template is grabbed and information is called from database dynamically. *
You question is a bit broad. So I'll answer as mush as I can understand.
To access to
/profile/user
, you have to use URL-rewriting. You have to enable themod_rewrite
of Apache (if it's your webserver). Then you have to define rules in a.htaccess
file.So, browsing to
http://host/profile/namehere
will useprofile.php
and$_GET['user']
will be defined with"namehere"
.Display informations in
profile/namehere
page (profile.php
untested):Template example :