hi
All jobtitle will be displayed in a table with hyperlink.when the jobtitle is clicked.it should fetch description,email etc from the database and display it.
please tell me how to link the pages based on the tobtitle or id....when the hyperlink is clicked it is not displaying the data from the database.

first page.php
echo "<table width='60%' border='1' style='padding-right: 6px'>";
$result=mysql_query("SELECT jobtitle FROM please");
print "<tr><td>jobtitle </td></tr>";
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{

$line = mysql_fetch_row($result);
print "<tr><td><a href='welcome.php'>$line[0]</td></tr>";
}
echo "</table>";


welcome.php
echo "<table width='50%' border='1'>";
$result=mysql_query("SELECT * FROM please where jobtitle='$line'");
for ($i = 0; $i < 1; ++$i)
{
$line = mysql_fetch_row($result);
print "<tr><td>Name</td><td> $line[0]</td></tr>";
print "<tr><td>Company Name</td><td> $line[1]</td></tr>";
print "<TR><td>Company Address </td><td>$line[2]</td></tr>";
print "<tr><td>Email Id </td><td>$line[3]</td></tr>";
print "<tr><td>Job Title</td><td> $line[4]</td></tr>";
}
echo "</table>";

you must use the get method or a session to carry your variable to the next page.
this is a sample with the get method:

first page.php

echo "<table width='60%' border='1' style='padding-right: 6px'>";
$result=mysql_query("SELECT jobtitle FROM please");
print "<tr><td>jobtitle </td></tr>";
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{

$line = mysql_fetch_row($result);
print "<tr><td><a href='welcome.php?jobtitle=".$line[0]."'>".$line[0]."</td></tr>";
}
echo "</table>";

welcome.php

$line=$_GET['jobtitle'];
echo "<table width='50%' border='1'>";
$result=mysql_query("SELECT * FROM please where jobtitle='$line'");
for ($i = 0; $i < 1; ++$i)
{
$line = mysql_fetch_row($result);
print "<tr><td>Name</td><td> $line[0]</td></tr>";
print "<tr><td>Company Name</td><td> $line[1]</td></tr>";
print "<TR><td>Company Address </td><td>$line[2]</td></tr>";
print "<tr><td>Email Id </td><td>$line[3]</td></tr>";
print "<tr><td>Job Title</td><td> $line[4]</td></tr>";
}
echo "</table>";

thanks it is working

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.