PHP Popup Page show content of records in db -
i have links on php page lists records database.
the links this:
<a href="http://domain.com?id=1">view records</a> <--id @ end
what want click on link , option popup shows fields id 1
what's easiest way show fields id=1 on popup when click link?
for example: have table this:
id | name | surname -------------------- 1 | bob | brown 2 | ken | blob and click on link looks this:
<a href="http://domain.com?id=1">view records</a> i need popup open , display this:
id - 1 name - bob surname - brown
very rudimentary example of 1 (of many ways) popup window::
<a href="javascript:void(0)"onclick="window.open('http://domain.com/popup.php?id=1', 'view','width=300,height=200,menubar=yes,status=yes')">view records</a> popup.php:
<?php $con = mysql_connect("localhost","username","password"); if (!$con) die('could not connect: ' . mysql_error()); mysql_select_db("my_database", $con); $result = mysql_query("select * mytable myid=".$_get['id']); $row = mysql_fetch_array($result); echo 'id - '.$row['id'] . '<br/>'; echo 'name - '.$row['name'] . '<br/>'; echo 'surname - '.$row['surname'] . '<br/>'; mysql_close($con); ?>
Comments
Post a Comment