Greetings,
I have a script to edit a simple user table, the form consists of a dropdown menu to select which user to edit, a checkbox followed by a username change, the same is true 4 password and permissions.
here is table structure:
id int auto, Pkey, Not null
username varchar
password varchar
perm enum ('user','admin') default = user
everything works fine when the form is completed fully entered, but if i select a user and check only 'change password check box', change the password and hit submit the result is a new password but the username is erased. and viseversa if username is changed
here are the querys in my php script:
if ($_POST[conf_username]!=' ')
{
//start update
$query_edit_user_u= "UPDATE store_admin SET username='$_POST[username]' WHERE id='$_POST[sel_id]'";
$issue_query_edit_user_u = mysql_query($query_edit_user_u) or die(mysql_error());
}
if ($_POST[conf_password]!=' ')
{
//start update
$query_edit_user_p= "UPDATE store_admin SET password='$_POST[password]' WHERE id='$_POST[sel_id]'";
$issue_query_edit_user_p = mysql_query($query_edit_user_p) or die(mysql_error());
}
if ($_POST[conf_perm]!=' ')
{
//start update
$query_edit_user_pr= "UPDATE store_admin SET perm='$_POST[perm]' WHERE id='$_POST[sel_id]'";
$issue_query_edit_user_pr = mysql_query($query_edit_user_pr) or die(mysql_error());
}