Jump to content

Help Changing a selection box to a text input box for login form


mennell

Recommended Posts

I have this login script that I just cant make work. It's from an open source project, and I can usually hack php but I'm having problems getting it to work.

 

OK what I'm trying to do is change a selection box that is populated from a database to a text box where the user inputs thier company name that is then matched to matching db field.I'm sure that this is realy simple but I'm having a bit of a brain fart about this

 

Here's the code

 

start_form(false, false, $_SESSION['timeout']['uri'], "loginform");

start_table(false, "class='login'");

start_row();

echo "<td align='center' colspan=2>";

if (!$login_timeout) { // FA logo

    echo "<a target='_blank' href='$power_url'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>";

} else {

echo "<font size=5>"._('Authorization timeout')."</font>";

}

echo "</td>\n";

end_row();

 

echo "<input type='hidden' id=ui_mode name='ui_mode' value='".$_SESSION["wa_current_user"]->ui_mode."' />\n";

if (!$login_timeout)

table_section_title(_("Version")." $version  Build $build_version - "._("Login"));

$value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($allow_demo_mode ? "demouser":"");

 

text_row(_("User name"), "user_name_entry_field", $value, 20, 30);

 

$password = $allow_demo_mode ? "password":"";

 

password_row(_("Password:"), 'password', $password);

 

if ($login_timeout) {

hidden('company_login_name', $_SESSION["wa_current_user"]->company);

} else {

if (isset($_SESSION['wa_current_user']->company))

$coy =  $_SESSION['wa_current_user']->company;

else

$coy = $def_coy;

echo "<tr><td>"._("Company")."</td><td><select name='company_login_name'>\n";

for ($i = 0; $i < count($db_connections); $i++)

echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>";

echo "</select>\n";

start_row();

label_cell($demo_text, "colspan=2 align='center'");

end_row();

};

end_table(1);

echo "<center><input type='submit' value='  "._("Login -->")."  ' name='SubmitUser'"

.($login_timeout ? '':" onclick='set_fullmode();'")." /></center>\n";

 

foreach($_SESSION['timeout']['post'] as $p => $val) {

// add all request variables to be resend together with login data

if (!in_array($p, array('ui_mode', 'user_name_entry_field',

'password', 'SubmitUser', 'company_login_name')))

echo "<input type='hidden' name='$p' value='$val'>";

}

end_form(1);

 

Thanks in advance

 

 

Hi

you cant use jquery ?

if yes use this http://api.jquery.com/html/  . than on event of the user you can change the simple html to whatever you want to show .

 

if you dont know how to put jquery inside php its not so hard :

 

echo ' <script> ...... </script> ;

hope it will help its much easier than what you try to do , and maybee you need to think on a differnte way to your problem .

Avi .

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.