Jump to content

Where is my form going wrong?


john.muckley
Go to solution Solved by cyberRobot,

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!!

Edited by john.muckley
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.