this code doesnt work....it doesnt get the information from the row to the text field automatically

<HTML>
<?php
if($submit)
   {
	$db = mysql_connect("localhost", "xxxxx","xxxx");
	mysql_select_db("xxxxxx",$db);
	$sql = "INSERT INTO amx_regusers (nick, pass, flags)
	VALUES ('$nick','$pass','$flags')";
	$result = mysql_query($sql);
	echo "Thank you! Information entered.\n";
   }

else if($update)
   {
	$db = mysql_connect("localhost", "boyem","xxxxx");
	mysql_select_db("boyem_com",$db);
	$sql = "UPDATE amx_regusers SET nick='$nick',pass='$pass',flags='$flags'WHERE nick=$'nick'";
	$result = mysql_query($sql);
	echo "Thank you! Information updated.\n";
   }

else if($id)
   {
	$db = mysql_connect("localhost", "boyem", "xxxxx");
	mysql_select_db("boyem_com",$db);
	$result = mysql_query("SELECT * FROM amx_regusers WHERE nick=$'nick'",$db);
	$myrow = mysql_fetch_array($result);
?>

<form method="post" action="<?php echo $PHP_SELF?>">
Nick:<input type="Text" name="nick" value="<?php echo $myrow["nick"]?>"><br>
Pass:<input type="Text" name="pass" value="<?php echo $myrow["pass"]?>"><br>
Flags:<input type="Text" name="flags" value="<?php echo $myrow["flags"]?>"><br>
<input type="Submit" name="update" value="Update information"></form>

<?

}

else

{?><form method="post" action="<?php echo $PHP_SELF?>">

Nick:<input type="Text" name="nick"><br>
Pass:<input type="Text" name="pass"><br>
Flags:<input type="Text" name="flags"><br>
<input type="Submit" name="submit" value="Enter information"></form>
<?
}
?>
</HTML>

any ideas

    Hi,
    in this situation it's used to edit outputted html and look what php echo on value field of text tag...

    but i think the problem is your query and the result may be empty.

    $result = mysql_query("SELECT * FROM amx_regusers WHERE nick=$'nick'",$db);

    because $nick has a ' after $....

    see you

      the problem is on the web page this form shows up

      Nick:<input type="Text" name="nick"><br>
      Pass:<input type="Text" name="pass"><br>
      Flags:<input type="Text" name="flags"><br>
      <input type="Submit" name="submit" value="Enter information"></form>

      but not this one (where 2 forms both shoudl showup)

      <form method="post" action="<?php echo $PHP_SELF?>">
      Nick:<input type="Text" name="nick" value="<?php echo $myrow["nick"]?>"><br>
      Pass:<input type="Text" name="pass" value="<?php echo $myrow["pass"]?>"><br>
      Flags:<input type="Text" name="flags" value="<?php echo $myrow["flags"]?>"><br>
      <input type="Submit" name="update" value="Update information"></form>

        Write a Reply...