can anybody help me by pasing the codes for how to show only the logged in users details..
first tabel for login form... where user give his user name and password to login..
second tabel will be displayed after his succussive login...
in the first form only two textbox and 1 submit button are available..
tell me how to pass the user_id of that corresponding user to the next page so that i can select the appropriate user_id and show thier details.
how to pass data through submit button?

these are the two tabels...

CREATE TABLE `users` (
  `user_id` tinyint(4) unsigned NOT NULL auto_increment,
  `user_name` varchar(255) NOT NULL,
  `user_answer` varchar(255) NOT NULL,
  `user_email` varchar(255) NOT NULL,
  `user_password` varchar(255) NOT NULL,
  `user_password1` varchar(255) NOT NULL,
  PRIMARY KEY  (`user_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
CREATE TABLE `post_my_resume` (
  `user_resume_id` tinyint(4) NOT NULL auto_increment,
  `user_first_name` varchar(255) NOT NULL,
  `user_last_name` varchar(255) NOT NULL,
  `user_dof_birth` varchar(255) NOT NULL,
  `user_place` varchar(255) NOT NULL,
  
  `user_id` varchar(255) NOT NULL,
  
  PRIMARY KEY  (`user_resume_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

Hi vijukumar,

You should make it so that the login form posts to the same page as with the login form $_SERVER;

Upon successful login you should have it show a link for the user to click and look at the resume.

Upon successful login:

//code to check login

$login = 1;

if($login == 1 && isset($_SESSION['username']) { // user logged in
 $username = $_SESSION['username'];

$sql = "SELECT user_id FROM `users` WHERE user_name='$username'";
$result = mysql_query($sql) or die("Error in Sql: ".mysql_error());

$row = mysql_fetch_array($result);
$count = mysql_num_rows($result);

$uid = $row['user_id'];

if($count == 1) {

echo "<a href='resume_page.php?uid=$uid' target='_self'>View Resume</a>";

} else {

}
}

On the resume page you'll use GET like this:

if(isset($_GET['uid']) && is_numeric($_GET['uid']) { //is_numeric stops people changing it to text or an array, which might cause problems.

$uid = htmlspecialchars($_GET['uid']); // again more protection, better to be safe than sorry.

$sql = "SELECT * FROM post_my_resume WHERE user_id='$uid'";
$result = mysql_query($sql) or die("Error in SQL: ".mysql_error());
$row = mysql_fetch_array($result);

//user $row['field'] now to format your page as you want it.

} else {
//if uid is not set, or if it is not numeric. Show them an error message.
}

Hope that helps,

Sam

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.