Yeah but that's using a form, you don't need to do that.
GET refers to the URL. You're getting bits of info from a URL. For example, if you see a site like this:
www.site.com/index.php?page=4&act=news&newsid=3
Or something like that, they are using GET to deal with the URL.
You turn each piece of info into a variable. Using the above example, you'd have something like this:
$page = $_GET['page'];
$page would equal 4
$act = $_GET['act'];
$act would equal news
$newsid = $_GET['newsid'];
$newsid would equal 3
This is completely dynamic by the way, you'll only be typing your database records.
I'll give you an example and you should be able to go from there.
Page.php - PHP Code:
<?php
// First lets assign some variables
// I'm only going to assign userid for now
// I'll be using mysql_escape_string to escape the GET variables to prevent MySQL injection
$userid = mysql_escape_string ($_GET['userid']);
if (empty ($userid)) {
// $userid is empty.... now we must display all of the names to click on
$sql = mysql_query ("SELECT * FROM table ORDER BY user_id DESC");
$num = mysql_num_rows ($sql);
if ($num > 0) {
// check if there are any users
while ($row = mysql_fetch_array ($sql)) {
echo '<a href="page.php?userid='.$row['user_id'].'">'.$row['username'].'</a><br />';
// This is there we make the dynamic list of names
// You just have to have a user_id in your table, and make it
// auto_increment so that each user gets his own ID - completely dynamic
}
} else {
// no users
echo 'There are no users in the database!';
}
} else {
// the $userid is not empty, so someone has clicked a name and been linked here
// first lets check if the $userid is actually in the database
$sql = mysql_query ("SELECT * FROM table WHERE user_id='".intval ($userid)."' LIMIT 1");
// note the use of intval, this forces the string to be an integer - which also prevents MySQL injection
$num = mysql_num_rows ($sql);
if ($num > 0) {
// the user IS in the database, so go ahead and display his information
$row = mysql_fetch_array ($sql);
echo '<a href="page2.php?userid='.$userid.'">'.$row['realname'].'</a>';
// now this will link you to "page2.php"; there you can list the next set of information
} else {
// user was not in the database; return bad ID
echo 'ERROR: Invalid ID!';
}
}
?>
So using my example, on "page2.php" you could list the rest of his info. You could also do all of this on one page if you want, just keep checking the different variables if they are empty or not. If they aren't empty, just display the code for them, if they are empty, display the code for the previous variable.
If all variables are empty, just display the main page (which is what my code above will do).