Geoff wrote:
I have a page that contains a form that requires authorization to access the page. I use a MYSQL table which contains a user name and password, along with other info like full name and phone number. When the user enters his/her username and password and is granted access to the form, I would like certain fields in the form (like full name, phone number) to be automatically filled in from the data contained in the mysql table of that user. Can someone point my in the right direction?
Hi Geoff,
Yeah, u got a simple solution. suppose ur login page is login.php. The form action goes to suppose verify.php.
In verify.php, ur querry is suppose like this:
$query = select * from user_table where log_name=$user_entered_name and password=$user_entered_password.
if u get the matches for ur login name and
$res = mysql_query($query,.....);
$d=mysql_fetch_array ($res);
$user_id = $d["user_id"];
$user_id will be obtained when there is data matching.
Then redirect the page to the required page with user id in querystring.
In the form page, if the user id is set, query the user table with that id, get the data and move ahead.
simple ??
Bhushan
ps: use of session will help u from mishandling of the files. i would prefer that for the idea i gave 🙂 we do the same with session. so u need to check is session is still valid and user id exists. thats double check and works fine.