Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

HOW TO KNOW WHICH NAME THE USER HAS CLICKED

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

HOW TO KNOW WHICH NAME THE USER HAS CLICKED

Postby vikaspa » Sun Aug 04, 2002 10:31 pm

Hi

I am new to PHP !!

I can read data base and display the Employee Names on a web page.

Now I want
1. User to click on an employee name say "Andre'
2. and a new page should open up display the employee details of 'Andre' or the employee name on which the user has clicked.


Please help me ..it is very very urgnt.

I am confused as how do i get the employee name on which the user has clicked.

With regards
Vikas AThavale
vikaspa@vsnl.com
vikaspa
New php-forum User
New php-forum User
 
Posts: 21
Joined: Wed Jun 19, 2002 10:03 pm

Postby Joan Garnet » Mon Aug 05, 2002 3:22 am

To reach what you want you'll need to display those names from a database query as links:

Code: Select all
$sql="SELECT * FROM ".$table." ORDER BY name DESC";
$result=mysql_query($sql,$db);

//output the result
if(!isset($id)){
        while ($row=mysql_fetch_array($result)){
   echo "<table width='100%'><tr><td>";
   echo "name: <a href='employees.php?id=".$row["id"]."'>".$row["name"]."</a>";
   echo "</td></tr></table>";
        }
}

if (isset($id)){
        while ($row=mysql_fetch_array($result)){
   echo "<table width='100%'><tr><td>";
   echo "name: ".$row["name"]."";
   echo "</td><td>age: ".$row["age"]."";
                and so on.....
                 echo "</tr></table>";
        }
}

That's it I think
:)
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars


Return to PHP coding => General

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron