I'm trying to make php user profile view system.
I have these two scripts.
members.php
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$Members = mysql_query(" SELECT email FROM users")
or die(mysql_error());
$numRowsMembers = mysql_num_rows($Members);
?>
<table border="0">
<?php
for($count = 1; $count <= $numRowsMembers; $count++)
{
$name = mysql_fetch_array($Members);
?>
<tr>
<?php
echo '<td><a href="member_profile.php?
username=' . $name['email'] . '">' . $name['email'] . '</a></td>';
?>
</tr>
<?php
}
?>
</table>
member_profile.php
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$email = $_GET['email'];
$user = mysql_query(" SELECT * FROM users WHERE email = '$email' ");
$user = mysql_fetch_assoc($user);
echo "<h1>User Information</h1>";
echo "<b>Email:</b>"." ".$user['email']."<br>";
echo "<br>";
echo '<form name="backlistfrm" method="post" action="member.php"';
echo '<input type="submit" value="Back to the list"';
echo '</form>';
echo "<br>";
echo "<a href='http://localhost/logout.php'>Logout</a> ";
?>
Now when I open the member.php page it has the
list of all the emails from users table as I want.
But when I click on any email to view his profile
on the member_profile.php page, there is the error
Notice: Undefined index: email in C:\wamp\www\post\member_profile.php on line 8
Any one call tell me how to fix this error?
I have these two scripts.
members.php
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$Members = mysql_query(" SELECT email FROM users")
or die(mysql_error());
$numRowsMembers = mysql_num_rows($Members);
?>
<table border="0">
<?php
for($count = 1; $count <= $numRowsMembers; $count++)
{
$name = mysql_fetch_array($Members);
?>
<tr>
<?php
echo '<td><a href="member_profile.php?
username=' . $name['email'] . '">' . $name['email'] . '</a></td>';
?>
</tr>
<?php
}
?>
</table>
member_profile.php
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$email = $_GET['email'];
$user = mysql_query(" SELECT * FROM users WHERE email = '$email' ");
$user = mysql_fetch_assoc($user);
echo "<h1>User Information</h1>";
echo "<b>Email:</b>"." ".$user['email']."<br>";
echo "<br>";
echo '<form name="backlistfrm" method="post" action="member.php"';
echo '<input type="submit" value="Back to the list"';
echo '</form>';
echo "<br>";
echo "<a href='http://localhost/logout.php'>Logout</a> ";
?>
Now when I open the member.php page it has the
list of all the emails from users table as I want.
But when I click on any email to view his profile
on the member_profile.php page, there is the error
Notice: Undefined index: email in C:\wamp\www\post\member_profile.php on line 8
Any one call tell me how to fix this error?