Jump to content

Just a quick one .....


Recommended Posts

Im trying to make a form where if you click edit it lets you change a username, it kinda works it lets you pick a name but when it sends the name to the data base it just leaves it blank  :-\ code is below

echo " 	<Tr><Td>Username <td>:<td>$info[username] <a href=cont.php?edit=username>Edit</a></td> ";
if($_GET[edit] == "username") { echo " <tr><Td> <input type =text name=name value='$info[username]'> <td> : <td> <a href=cont.php?edit=saveusername>Save</a> </td> "; }
if($_GET[edit] == "saveusername" ) {  $username = str_replace(">", ">", $username);


 $username = str_replace("<", "<", $username);





 $check1 = mysql_query("SELECT username FROM users WHERE username='$_GET[name]'");


 if ((mysql_num_rows($check1) != 0)) {


                 
 echo 'Sorry, name already in use<br>';


 }


 else {


 $updateuserdb = mysql_query("update users set username='$_GET[name]'  where id=$info[id]");


 echo "You have changed your username.<br>";


 }


} 

Link to comment
https://forums.phpfreaks.com/topic/62701-just-a-quick-one/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.