I already have written a login and register script. The user can login to their account edit their details etc. The details are stored in a users table which has many different data properties related to the user.
I was wondering, how do I make it so they can view their profile and it shows all the data they input. For example, if somebody with username “bob” registered and changed his data, he can click a link “view profile” and he can see his public user profile. I know how to fetch entries and display the data but my problem is I don’t understand how to make a profile for my users that can be seen by others and/or themselves. I want these pages to be dynamically created for each user.
Also, if I had a page that retrieved all the recently registered members, it could link to their profile pages.
It is a very common thing across websites and I know there are CMS’s that already do this like drupal but I want to code a small controlled solution by myself. Thanks!
Make your page ‘profile.php’
1) Pass id to that page using Get String. Link would be : ……/profile.php?id=3
To learn more about Get and Post Method of form submission. And how PHP handles it ($_POST & $_GET) google it.
2) In that page ‘profile.php’
3) If you want to dynamically tell the person that what his profile link is:
Supposing you have $id of that person :
$link = ‘…../profile.php?id=’ . $id;
Please consider learning basic php first. Like cookies, get, post, functions, db handling, sessions, string handling, array handling, global variables.