<?php require_once('connections/careergroup.php'); ?>
<html>
<head>
<title> <?php echo $first_name; ?> <?php echo $lastname; ?>s Profile</title>

</head>
<body>
<?php
// Check for a form submission


    if (isset($_GET["username"])){



    $email = $_GET['username'];

    mysql_connect ("$hostname_careergroup",  "$username_careergroup", "$password_careergroup") 
    or die ("Could not connect to the server");

    mysql_select_db("careergroup") or die ("That database could not be found");
    $userquery = mysql_query("SELECT * FROM members WHERE username= '$email'") or die ("the query"); 

    if (mysql_num_rows($userquery) != 1) {
    die ("that member could not be found!");

    while($row = mysql_fetch_array ($userquery, MYSQL_ASSOC)){
        $first_name = $row['first_name'];
        $last_name = $row['last_name'];
        $email = $row['email'];
        $password = $row['password'];
        $sex = $row['sex'];
        $dbusername = $row['username'];
    }
    if ($email != $email) {

      die ("there has been a fatal erroe. please try again. ");


    }

    if ($activated == 0) {
        $active = "The account has not been activated.";
    }else{
        $active = "The account has been activated.";
    }

    // See what lever the user is

    if ($access == 0) {
        $admin = "This user is not an administrator.";
    }else {
        $admin = "This use is an administrator.";
    }
    }
?>

<h2><?php echo $first_name; ?> <?php echo $last_name; ?>s Profile</h2><br />

<table>


        <tr><td> Firstname:</td><td><?php echo $first_name; ?></td></tr>


    <tr><td> Lastname:</td><td><?php echo $last_name; ?></td></tr>
    <tr><td> Email:</td><td><?php echo $email; ?></td></tr>
    <tr><td> Password:</td><td><?php echo $pastword; ?></td></tr>
    <tr><td> Sex:</td><td><?php echo $sex; ?></td></tr>
<?php


    } else die ("you need to specify a username!");






?>
</body>
</html>

Are you getting an error? Multiple errors? What seems to be the problem?

it is saying the username dot define

sorry about that bit it is saying "you need to specify a username!"

the email address is the username

You have conflict with your $email variable
Here in code (even it ain't all as code lines as descripted), in line 5., you have:

$email = $_GET['username'];

and than in line 19., you have rewriten variable

$email = $row['email'];

Try to use different names for each of them.

{i changed it to thia but it did not work

}

<?php require_once('connections/careergroup.php'); ?>
<html>
<head>
<title> <?php echo $first_name; ?> <?php echo $lastname; ?>s Profile</title>

</head>
<body>
<?php
// Check for a form submission

if (isset($_GET["username"])){



$user = $_GET['username'];

mysql_connect ("$hostname_careergroup",  "$username_careergroup", "$password_careergroup") 
or die ("Could not connect to the server");

mysql_select_db("careergroup") or die ("That database could not be found");
$userquery = mysql_query("SELECT * FROM members WHERE username= '$email'") or die ("the query"); 

if (mysql_num_rows($userquery) != 1) {
die ("that member could not be found!");

while($row = mysql_fetch_array ($userquery, MYSQL_ASSOC)){
    $first_name = $row['first_name'];
    $last_name = $row['last_name'];
    $email = $row['username'];
    $password = $row['password'];
    $sex = $row['sex'];
    $dbusername = $row['username'];
}
if ($user != $email) {

  die ("there has been a fatal erroe. please try again. ");


}

if ($activated == 0) {
    $active = "The account has not been activated.";
}else{
    $active = "The account has been activated.";
}

// See what lever the user is

if ($access == 0) {
    $admin = "This user is not an administrator.";
}else {
    $admin = "This use is an administrator.";
}
}

?>

<h2><?php echo $first_name; ?> <?php echo $last_name; ?>s Profile</h2><br />

<table>

    <tr><td> Firstname:</td><td><?php echo $first_name; ?></td></tr>


<tr><td> Lastname:</td><td><?php echo $last_name; ?></td></tr>
<tr><td> Email:</td><td><?php echo $email; ?></td></tr>
<tr><td> Password:</td><td><?php echo $pastword; ?></td></tr>
<tr><td> Sex:</td><td><?php echo $sex; ?></td></tr>

<?php

} else die ("you need to specify a username!");

?>
</body>
</html>

what wronh with this line

$userquery = mysql_query("SELECT * FROM members WHERE username= '$email'") or die ("the query");

this is what i got my search.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>search for friends</title>
</head>

<body>
<h2> Search for a user:</h2><br/><br/>
<form action="profile.php" method="GET"

    <table>


    <tr><td>Email address:</td><td><input type="text" id="username" name="username" /></td></tr>
    <tr><td><input type="submit" id="submit" name="submit" Value="Search"/></td></tr>
 </table>

</form>
</body>
</html>

and this is my profile.php

<?php require_once('connections/careergroup.php'); ?>
<html>
<head>
<title> <?php echo $first_name; ?> <?php echo $lastname; ?>s Profile</title>

</head>
<body>
<?php
// Check for a form submission

if (isset($_GET["username"])){



$email = $_GET['username'];

mysql_connect ("$hostname_careergroup",  "$username_careergroup", "$password_careergroup") 
or die ("Could not connect to the server");

mysql_select_db("careergroup") or die ("That database could not be found");
$userquery = mysql_query("SELECT * FROM members WHERE username= '$email'") or die ("the query"); 

if (mysql_num_rows($userquery) != 1) {
die ("that member could not be found!");

while($row = mysql_fetch_array ($userquery, MYSQL_ASSOC)){
    $first_name = $row['first_name'];
    $last_name = $row['last_name'];
    $email = $row['username'];
    $password = $row['password'];
    $sex = $row['sex'];
    $dbusername = $row['username'];
}
if ($user != $email) {

  die ("there has been a fatal erroe. please try again. ");


}

if ($activated == 0) {
    $active = "The account has not been activated.";
}else{
    $active = "The account has been activated.";
}

// See what lever the user is

if ($access == 0) {
    $admin = "This user is not an administrator.";
}else {
    $admin = "This use is an administrator.";
}
}

?>

<h2><?php echo $first_name; ?> <?php echo $last_name; ?>s Profile</h2><br />

<table>

    <tr><td> Firstname:</td><td><?php echo $first_name; ?></td></tr>


<tr><td> Lastname:</td><td><?php echo $last_name; ?></td></tr>
<tr><td> Email:</td><td><?php echo $email; ?></td></tr>
<tr><td> Password:</td><td><?php echo $pastword; ?></td></tr>
<tr><td> Sex:</td><td><?php echo $sex; ?></td></tr>

<?php

} else die ("you need to specify a username!");

?>
</body>
</html>

what wronh with this line

$userquery = mysql_query("SELECT * FROM members WHERE username= '$email'") or die ("the query");

If you have changed $_GET['username'] variable to $user, you need to change it in query too instead *$email* variable.

now it is saying that all these are not fefined

{

<table>

   <tr><td> Firstname:</td><td><?php echo $first_name; ?></td></tr>
<tr><td> Lastname:</td><td><?php echo $last_name; ?></td></tr>
<tr><td> Email:</td><td><?php echo $email; ?></td></tr>
<tr><td> Password:</td><td><?php echo $pastword; ?></td></tr>
<tr><td> Sex:</td><td><?php echo $sex; ?></td></tr>

</table>

}

Try with:
while($row = mysql_fetch_assoc($userquery))

This is my search page (search.php) how to i link this to the code above so that is capture the email to varified to the database.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>search for friends</title>
</head>

<body>
<h2> Search for a user:</h2><br/><br/>
<form action="profile_finder.php" method="GET"

    <table>


    <tr><td>Email address:</td><td><input type="text" id="email" name="email" /></td></tr>
    <tr><td><input type="submit" id="submit" name="submit" Value="Search"/></td></tr>
 </table>

</form>
</body>
</html>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.