Jump to content

Where is my form going wrong?


john.muckley

Recommended Posts

Hey guys,

 

so i've got a create user form which allows new users to be created and added into the database as valid users for my site.

 

as part of this form, you can select an access level, ie admin, manager, user.

For some reason, no matter what i put here, the new user is always added as level 3 - which is user.

I've read and reread the code and cannot see for the life of me why it is doing this!

 

Can anyone help?

 

Here is the php code which processes the new user request...

$accesslv1=$_POST['accesslv'];   //reading the POST variable from the create userpage

//determine what access level this user has
if(accesslv1=="admin"){
$accesslv=1;  //this would be an admim user
}
elseif(accesslv1=="manager"){
$accesslv=2;  //this would be a manager
}
else{
$accesslv=3;  //this would be a user
}


for debugging, i popped this at the end instead of a redirect...

echo "Username: " .$username . "<br> AccessLevel: " .$accesslv1 ." (lv" .$accesslv .")";

and all i get is this...

 

Username: test1
AccessLevel: manager (lv3)

 

This should read manager (lv2), but for whatever reason its not doing!

 

thanks in advance for any help guys!!

Link to comment
https://forums.phpfreaks.com/topic/277409-where-is-my-form-going-wrong/
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.