janim Posted August 4, 2007 Share Posted August 4, 2007 hello every body i have simple script that read from database mysql_connect($server, $datauser, $datapass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table order by id asc") or die (mysql_error()); if (mysql_num_rows($result)) { echo "Registered People:<ul>"; while ($qry = mysql_fetch_array($result)) { echo "<li><a href=javascript:popUp('$qry[user]')>$qry[name]</a> from $qry[con] <br/> $qry[key]</li><br/>"; } } as you can see it's show simple details about contact's but i want when someone click the name it's open new popup window showing the full details about this person the problem is that i can't choose the right one every click that's mean when i click any name it's show the first name in mysql database i can't let the new page determine the specific person please any help about this sorry for my bad english Link to comment https://forums.phpfreaks.com/topic/63359-click-on-the-name-of-person-to-get-details-about-help/ Share on other sites More sharing options...
Fadion Posted August 4, 2007 Share Posted August 4, 2007 Id suggest using a target _blank in your link, as popups are annoying and at most cases blocked by anti popup software. Anyway the idea in your script is to open a new file, ex profile.php and pass a url variable that may be the id of the user. Im writing the sample without the popup call, but it would give u and idea: echo "<a href='profile.php?id={$qry['id']}'>{$qry['name']}</a>" U can have a profile.php with a standart template for the user (ex. full name, email, phone, description) and fill those values by getting the id of the selected users from the url variable using $_GET. Link to comment https://forums.phpfreaks.com/topic/63359-click-on-the-name-of-person-to-get-details-about-help/#findComment-315759 Share on other sites More sharing options...
ballhogjoni Posted August 4, 2007 Share Posted August 4, 2007 try this mysql_connect($server, $datauser, $datapass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table order by id asc") or die (mysql_error()); if (mysql_num_rows($result)) { echo "Registered People:<ul>"; while ($qry = mysql_fetch_array($result)) { echo "<a href=\"some.url?user=".$qry['user']."&name=".$qry['name']."\" target=\"_BLANK\">".$qry['user']." ".$qry['name']."</a> from ".$qry['con']." ".$qry['key']."<br/>"; } echo '<ul>'; } Then on the some.url page use the $_GET[''] to pull the values from the url and then use the SELECT from mySQL to print all the database info about that specifc record. Link to comment https://forums.phpfreaks.com/topic/63359-click-on-the-name-of-person-to-get-details-about-help/#findComment-315764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.