basically the person logs in with username and password.
In mysql there is name1, name2, which are filled in. I want the name1 and name 2 to be displayed on the webpage.
Beside name1 and name2 I will have colour1 and colour2 respectively which is a drop down menu where each user selects a colour and once submitted it saves it to the database beside in the same column as name1 and name2 are in.
the code below shows the login page.
<?php
// Inialize session
session_start();
// Include database connection settings
include('config.inc');
// Retrieve username and password from database according to user's input
$login = mysql_query("SELECT * FROM user WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "')");
// Check username and password match
if (mysql_num_rows($login) == 1) {
// Set username session variable
$_SESSION['username'] = $_POST['username'];
// Jump to secured page
header('Location: securedpage.php');
}
else {
// Jump to login page
header('Location: login.php');
}
?>
config.inc is the database connection.
So if the username and password is correct it goes to this page:
<?php
// Inialize session
session_start();
// Check, if username session is NOT set then this page will jump to login page
if (!isset($_SESSION['username'])) {
header('Location: login.php');
}
?>
<html>
<head>
<title>Secured Page</title>
</head>
<body>
<p>This is secured page with session: <b><?php echo $_SESSION['username']; ?></b>
<br>*********************</p>
<p><a href="logout.php">Logout</a></p>
</body>
</html>
Where the *** I need to insert the code where name1, name2 will be displayed along with their colour selection from drop down menuu which will be saved into the database.
I appreciate your help.
Thanks
Help














