Getting user name in text area

From: Date: Thu, 28 Mar 2002 22:48:05 +0000
Subject: Getting user name in text area
Groups: php.general 
Request: Send a blank email to php-general+get-90602@lists.php.net to get a copy of this message
Hi all, Here is what I have and what I am trying to do. I would like the user name to be printed in the Username text box but can't seem to get it there. I don't want the user to have to type there username in, just click the submit button and it is entered into the db. Can anyone show me what I have done wrong? $query="SELECT name FROM users WHERE uid={$session["uid"]}"; $ret = mysql_query($query); while(list($name)= mysql_fetch_row($ret)) print("<BR><BR><BR>$name"); ?> <table ALIGN="center" WIDTH="80%"><tr> <td><form ACTION="<?php echo($PHP_SELF);?>" METHOD=post> <? print "<td><br>Username: <input type=\"text\" value=\"$name\" name=\"u_name\" size=30></td></tr><tr><td>"; print "<input TYPE=\"submit\" name=\"action\" VALUE=\"Submit my entry\"></center><br><br>"; ?> </form></td></tr> </table> <? if($action = "Submit my entry"){ if (!empty($name)){ $enter = "insert into entry (id, user_name) values ('','$u_name')"; mysql_query($enter) or die(mysql_error()); } } TIA Jennifer

« previous php.general (#90602) next »