This topic is locked

select 'username' via drop-down box at login

1/4/2008 4:21:45 PM
PHPRunner General questions
V
voicemagic author

I would like to be able to select the username via a drop-down box at login.
I have a table of (50) predetermined usernames (location names) & passwords.
My client wants to be able to allow managers at each location to be able to select their respective location as the (username) & enter their password.
Once logiged in, the manager would only be able to browse employees in the employee table from the selected location.
I have everything working, but I have to enter in the location name (username) each time. I am trying to make it easier & less error prone.
I did not think this was a current option, but if not, can you point me in the right direction so I can modify the code or is there another possible way to make this work.
Thanks,

J
Jane 1/9/2008

Hi,
you can do it editing your pages manually on the Visual Editor tab.

Switch to HTML mode, find this code:

<INPUT name=username {$value_username}>

and replace it with this one:

{doevent name="TableName_username"}


Then edit your TableName_username event.

Here is a sample code:

global $conn;

$strSQL = "select Username from users";

$rs = db_query($strSQL,$conn);

$str = "";

$str.="<select name=username>";
while ($data = db_fetch_array($rs))

$str.="<option value=".$data["Username"].">".$data["Username"]."</option>";
$str.="</select>";

echo $str;

V
voicemagic author 1/21/2008

Hi,

you can do it editing your pages manually on the Visual Editor tab.

Switch to HTML mode, find this code:

and replace it with this one:

Then edit your TableName_username event.

Here is a sample code:


Thanks for the help, but I'm not sure where to insert the sample global $conn code.

I inserted it as a "BeforeProcessLogin" custom code even but I am getting an error.

Please advise.

J
Jane 1/22/2008

Hi,
add this code to your custom event on the Login page (yellow rectangle with TableName_username).

V
voicemagic author 1/22/2008

Hi,

add this code to your custom event on the Login page (yellow rectangle with TableName_username).


Now I understand, it's works perfectly, thank you, thank you, thank you!!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=25087&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />