Click here to Skip to main content
14,668,412 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to make a web portal using PHP as it has user registration and login and when user login it have a dashboard page which contains a form whose details goes to database and that specific user can Read/Update/Delete that data on other page of his account.

Can anybody please tell me that what should be the structure of the database?

What I have tried:

I am currently using PHP Session for login and created two database dblogin(user details) and check(dashboard form details) and i am not able to fetch that data for the specific user as I am not able to find parameter through which i can fetch the form data according to user.
Posted
Updated 13-Apr-17 5:37am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You need to go back to basics. I'll outline the approach because a full answer is about 5 chapters of a book on web-app development.

Firstly you will need to render an HTML page that presents a login form to the user. That form should include the Username and Password fields. Google-it to discover how to make such a form if you don't know.

Behind the above-mentioned form sits your PHP, indeed the PHP is basically squirting out the HTML in question.

When the form is submitted this raises a PHP call which should supply username and password variables. For example if you have posted variables "user" and "password" you can obtain these in PHP using $user = $_REQUEST['user'] and $password = $_REQUEST['password'].

It's likely that you will also want to use Session variables. These are the things that allow you to have persistence of a login within the current browser session - e.g. no need to login again if you open another tab into your app within the same browser session. Again, you'll need to research into Session variables.

The DB is not in itself a big deal and there's nothing in your description of the problem that constrains or even guides the DB design. I think that you're probably more puzzled about the fundamentals of how this stuff fits together. A very simple DB with a single table that stores allowed usernames and passwords (two columns plus a unique primary key for good practice).

I encourage you to go back to the basics yourself. Get a basic HTML form able to load from your server (in a browser), with a submit button that sends the form to the server, and some PHP able to then digest the submitted form data. Once you have that working you're in a position to start on the user-login side of things.

Here's an example that doesn't do exactly what you want but it's quite similar and should provide a good starting point.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100