Page 1 Userlist.php
This page list all the users in the sml table. It is simple and it does display all the users. When the view button is press it should cary the UID to the next page.
<?php
SESSION_START();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: small;
background: url(images/bg.gif);
}
</style>
</head>
<body>
<p> </p><p> </p>
<?php
$dbHostName = "localhost";
$dbUserName = "bcgint";
$dbPassword = "anise97";
$dbName = "bcgint";
function showerror()
{
die("Error " . mysql_errno() . " : " . mysql_error() );
}
$Query = "SELECT * FROM sml";
if (!($dbc = @ mysql_connect($dbHostName,
$dbUserName, $dbPassword)))
die("Could not connect to MySQL");
if (!(mysql_select_db($dbName
, $dbc)))
showerror();
if (!($Result = @ mysql_query ($Query, $dbc)))
showerror();
function DisplayUsers($Result)
{
print "\n<table border='1' align='center' width='750' cellpadding='2' cellspacing='0' bgcolor='#F0F0F0'>\n<tr>\n
" .
"\n<tr>" .
"\n\t<th width='200'>First Name</th>" .
"\n\t<th width='200'>Last Name</th>" .
"\n\t<th width='200'>Username</th>"
.
"\n\t<th width='100'>Password</th>"
.
"\n\t<th width='150'>Action</th>" .
"\n<tr>";
while ($Row = @mysql_fetch_array($Result
))
{
print "\n<tr>";
print "<td>" . $Row[FirstName] . "</td>";
print "<td>" . $Row[LastName] . "</td>";
print "<td>" . $Row[Username] . "</td>";
print "<td>" . $Row[Password] . "</td>";
print "<td>" . "<form method='POST' action='Welcome.php'>" . "<input type='hidden' value='$Row[UID]' name='name'>" . "<input type='submit' value='View'>" . "</form>" . "</td>";
print "\n</tr>";
}
print "\n</table>\n";
}
DisplayUsers($Result);
?>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
Page 2 should have the UID so that I could then display personal information.
<?php
SESSION_START();
$UID = $_POST['UID'];
$_SESSION['UID'] = $UID;
require('ConfigE.php');
require 'DBC.php';
echo "Session: <pre>";
print_r($_SESSION);
echo "</pre>";
?>
Here is the result of the above code.
Session:
Array
(
[UID] =>
)
As you can see the UID is blank I'm ready to pull all my hair.
Thanks for your help.
Rafael