Dear admins..!! i am sorry for my previous post, but, now i am asking you this because i am poor in JS scripting.... i have seen a website. Here the menu and content are displayed in two different DIVs, but, i cant understand how to use that, i have concerned my friends and masters too, byt, they also did not understand how to apply, so, can you help me out in intgrating these both files.

Please....

index.php

<ol>
<?php


mysql_connect('localhost','root','');

mysql_select_db('munnajax_fetch');

$query = "select * from interndb";
$result = mysql_query($query);

while ($row = mysql_fetch_array($result))
{
    echo "<li><a href='description.php?id=$row[id]'>$row[by]</a></li>";
}
echo "<br>";
?>
</ol>

<div id="targetspace">Description should come here</div>

description.php

<table width="400">
<?php


mysql_connect('localhost','root','');

mysql_select_db('munnajax_fetch');

$id = $_REQUEST['id'];

$query = "select * from interndb where id='$id'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);

echo "<tr><th>Intern By</th><td>$row[by]</td></tr>";
echo "<tr><th>Position</th><td>$row[title]</td></tr>";
echo "<tr><th>Duration</th><td>$row[duration]</td></tr>";
echo "<tr><th>Detailed Description</th><td>$row[desc]</td></tr>";


?>
</table>

Recommended Answers

All 3 Replies

if it's populated at runtime just do this:

<div id="targetspace"><?php include description.php; ?></div>

replace your code with the following code at lineno:14

<a href="#" onclick="getDescription('$row[id]')">$row[by]</a> </li>

and write a javascript function which internally coded ajax concept for getting data of a particular id (as said by pritaeas)

and place ajax result data to the target div

i think you got the concept now

please try it once i hope you will get the answer

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.