![]() |
PHP login redirect to id specific page
Hi all,
I am building a website at the moment and would like to redirect users to a page that displays the information relating to their id when they log in. I have the login script already I just cant get it to go to the right page. Foster |
I actually resolved the above issue. I now need to make it so the user can edit the information they are seeing.
Any help if appreciated. Foster |
We can't really help you with such generic information, but the basic strategy is this:
- Store current user info in session - Provide a link to an edit page - Edit page polls database info, plugs it into existing form fields - User hits "Update" and the info gets pushed back into the database, where database table info user id = session user id. |
Hi,
Thanks for your response. - Store current user info in session - This I have done - Provide a link to an edit page - This I have done - Edit page polls database info, plugs it into existing form fields - This I don't know how to do! - User hits "Update" and the info gets pushed back into the database, where database table info user id = session user id. I can get the page to poll the database info and show it to the specific user but not allow them to edit it. Foster |
Quote:
If i have understood your above requirement correctly your looking for below information else ignore. edit page is nothing like copy your original form page in new file and name it as edit.php?edit=edit Now select table from db as an array, using while condition echo its value in the respective input field as VALUE (Do not change the name at any cost but just add value="" to input filed) , For example check below. PHP Code:
but only effort you need to do is updating "VALUES" as per input types in the edit.php?edit=edit page. Let me know if you need any more information. Regards, Nani :cool: |
How would I get it to connect to my database? This is my code as it stands.
PHP Code:
|
Well I can't give you a verbatim set of directions because I don't know your database schema or what you're using to access it (Native methods, an ORM, PDO, etc), but... I've tossed in some pseudo code and removed irrelevant parts and replaced them with "..."
PHP Code:
|
then, for your update.php,
Code:
// Query through your form dataCode:
$myFields = array("name","regiment_name","Comname","HistoricalFigures","campaigns"); |
Ok, I've got it working to populate the text box based on a specific id. I now need to do it based on the data stored from a session.
|
in your login script try setting the page id there instead:
PHP Code:
PHP Code:
|
Hi Arcticwarrio,
I have that already it's when selecting the database that I have the problem. The code below selects ID 1 but I want it to select according the the username of the person logged in. PHP Code:
|
do users have an auto incremental id in the database?
|
if so it would simply be:
PHP Code:
|
What if I have it store the username in the session and not the UserID?
|
Quote:
PHP Code:
|
| All times are GMT +1. The time now is 05:04 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.