Jump to content

help me


danielbala

Recommended Posts

Hi....

 

im just trying to display the current login user's fullname in the field Current employee name in a file..i did the current user name to be displayed

 

This is code.

<?php
session_start();
if (isset($_SESSION['id'])){
$loginid=$_SESSION['id'];
}
if (isset($_SESSION['T_UserName'])){
$T_UserName=$_SESSION['T_UserName'];
}
if (isset($_GET['id'])){
$loginid=$_GET['id'];
//Get  login username if using GET 
$loginid=mysql_real_escape_string($loginid);
$query = "SELECT `username` FROM `details` WHERE id=$loginid";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$T_UserName=$row[0];
}
?>
<?php
if (isset($_SESSION['emp_id'])){
$loginid=$_SESSION['emp_id'];
}
if (isset($_SESSION['emp_name'])){
$CurrentEmpName=$_SESSION['emp_name'];
}
if (isset($_GET['emp_id'])){
$loginid=$_GET['emp_id'];
//Get  login username if using GET 
$loginid=mysql_real_escape_string($loginid);
$query = "SELECT `emp_name` FROM `login` WHERE emp_id=$loginid";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$CurrentEmpName=$row[0];
}
?>

 

this is form..

<form action="" method="post" enctype="multipart/form-data" name="employee" target="_self">
   <br />
   <br />
   <table border="1">
   <tr  width="569" colspan="2">
   <td>
     Current User            :  
            <input name="CurrentUser" type="text" disabled id="UserId" size="35" maxlength="35" readonly class="disabled"  value="<?php  echo $_SESSION['username'];?>"/>             Activity          :
            
             <input name="LogActivity" type="text" disabled id="ActLog" size="35" Value="List New Jobs" maxlength="35" readonly class="disabled" />   <br />
       Current Employee Name :  
            
            <input name="CurrentEmpName" type="text" disabled id="CurrentEmpId" size="35" maxlength="35" readonly class="disabled"  value="<?php  echo $_SESSION['emp_name'];?>"/>     
   </td>
       </tr>
   </table>

Link to comment
Share on other sites

@danielbala - Did you create the code?

 

 

The script looks like it was made to gather input from multiple pages. Some access the script via $_SESSION variables, while others use $_GET variables. However, the code provided doesn't show what happens when dealing with $_POST variables. Is there more code that's not being shown?

Link to comment
Share on other sites

Where to set the variable??

 

 

To be honest, I don't know. Since I'm not very familiar with how the code relates to the rest of the website, it's difficult to say where the $_SESSION variable needs to be set. The only thing I can say is that it needs to be set somewhere in the website where you know employee's name...which is probably on the page before getting to the form. :shrug:

 

Note that I don't have a lot of time (right now) to help with the issue. Of course, you can still post more questions / code. Maybe someone else will be able to help...or maybe I'll be able to help later.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.