this is my login proccess i call it getin.php
<?
$conn = mysql_connect("localhost","chaotici_commu","");
$db = mysql_select_db("chaotici_chaotic");
$result = MYSQL_QUERY("SELECT username, password from users WHERE username='$username' and password='$password'") or die ("Name and password not found or not matched");
$worked = mysql_fetch_array($result);
$user = $worked[username];
$password = $worked[password];
$html = $_POST['edithtml'];
if($worked)
echo "Welcome $user";
echo "<br>";
echo $_SERVER["REMOTE_ADDR"];
echo "<br>";
echo $_SERVER["HTTP_REFERER"];
?>
This is the login.html for the proccess of logging in.
<form action="getin.php" method="post">
Username: <input type="text" name="username" size="10">
Password: <input type="password" name="password" size="10">
<input type="submit" value="submit" name="submit">
</form>
This is the post where in the textarea gets processed into the mysql database. this edithp.php
<?
$link = mysql_connect('localhost','chaotici_commu', 'dragon')
or die("Could not connect");
mysql_select_db('chaotici_chaotic')
or die("Could not select database");
$result = MYSQL_QUERY("SELECT username FROM users WHERE username='$username'") or die ("Username not matched");
$worked = mysql_fetch_array($result);
$user = $worked[username];
$html = $_POST['edithtml'];
mysql_query($update) or die ("Could not add data to the table");
?>
This is the form for the edithp.php at the top. I call this text.html
<form action="edithp.php" method="post">
<div align="center">
<textarea name="edithtml" type="text" cols="60" rows="20" wrap="virtual" id="edithtml">
<!-- Do not remove meta tags
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
-->
</textarea>
<input name="Submit" type="submit" value="Update" class="buttons">
<input type="reset" name="reset" value="Undo" class="buttons">
</div>
</form>
Here's my problem, I'm trying to combine the two and i'm having some reall hard trouble. See when the user logs in they go to the page of getin.php right. So i used the include tag to put my text.html. The $user is not showing the username in
$update ="UPDATE users SET html='$html' WHERE username='$user' LIMIT 1";
so it will post the typed in data to the mysql database. I change the username='$user' into the username='aznjay' that is my username right and it works. Please help me with the $user thing and how i can combine this.