Alright, I am currently creating a page that allows for the user to see a basic directory of user phone numbers and gives of variables. The issue I am having is that I have a link so that if you want all the users information you can click on it and it will pop-up a window containing more contact information. I've tried cookies and I have tried session/get/post, etc, I just seem to be doing something wrong.

Any help would be appreciated.

while($a=mysql_fetch_array($result)){
$id = $a[id];
$query2 = "SELECT * FROM contacts WHERE id = '$id'";
$result2 = mysql_query($query2);
$b=mysql_fetch_array($result2);

	echo "<tr>";
	echo "<td align = \"center\">".$a['fname']." ".$a['lname']."</td>";
    echo "<td align = \"center\">".$b['h_phone']."</td>";
    echo "<td align = \"center\">".$b['c_phone']."</td>";
    echo "<td align = \"center\">".$b['w_phone']."</td>";
    echo "<td align = \"center\">".$b['f_phone']."</td>";
    echo "<td align = \"center\">".$b['email_1']."</td>";
	echo '<td align="center">';
	echo '<input type="submit" id="mode" name="mode" value="Look-up" onclick ="popup();"><br>';
	echo '</td>';
	echo "</tr>";


	}
	database_disconnect($db);
	echo '</table>';
}
?>

The function pop-up() is just:

<script type="text/javascript">
<!--
function popup(var id) {
window.open( "page.php?id="+$id, "myWindow", 
"status = 1, height = 300, width = 650, resizable = 0" )
}
//-->
</script>

Then on the receiving page:

$id = $_GET['id'];
	
	echo '<table width="100%" border="1">';
	echo "<tr>";
	echo $id;
	echo "</tr>";	
       ...
	echo '</table>';

I know it is definitely incorrect but I am learning :X

alright, I have resolved one issue. I had forgotten to place the value $id within php when using it in the javascript funciton.

Now my main issue is that since its inside a mysql_fetch_array, the final value of $id is 1 due to the way it is executed.

Is there anyway to specify which person i want to select from within the while loop because otherwise I am kind of out of luck.

alright, I have resolved one issue. I had forgotten to place the value $id within php when using it in the javascript funciton.

Now my main issue is that since its inside a mysql_fetch_array, the final value of $id is 1 due to the way it is executed.

Is there anyway to specify which person i want to select from within the while loop because otherwise I am kind of out of luck.

try using a if statement to check dat name in the while loop....save the entry when true......

while($kk=$query->fetch_object())
{
.....->.....
if($kk->name=='name or $name')
{
$x='$name';}
}
echo $name;

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.