Codeigniter Database Selection On Login Screen
<p>Hi I tried Login screen Username password and one more field year </p>

<p>Year is Database name Selection </p>

<p>For example i have 2015_db,2016_db,2017_db
Based on login screen selection field of Year</p>

<pre><code>&lt;?php echo form_open('login',$attributes); ?&gt;

    &lt;label for="ddlLanguage"&gt;English&lt;/label&gt;
    &lt;input type="radio" name="ddlLanguage" id="ddlLanguage" value="eng" checked="checked"&gt; 
    &lt;label for="ddlLanguage"&gt;Arabic&lt;/label&gt;
    &lt;input type="radio" name="ddlLanguage" id="radio2" value="ar"&gt; 

    &lt;div class="clearfix"&gt;&lt;/div&gt;

    &lt;input type="text" name="txtUsername" value="&lt;?= $this-&gt;vAdmin;?&gt;" class="usernameLogin" /&gt;

    &lt;input type="password" name="txtPassword" value="&lt;?= $this-&gt;vPass;?&gt;" class="usernameLogin" /&gt;

    &lt;select name="year" id="year" &gt; 
        &lt;option value="2015"&gt;--2015--&lt;/option&gt;
        &lt;option value="2015"&gt;--2016--&lt;/option&gt;
    &lt;/select&gt;

    &lt;label class="label" for="chkSave" &gt; REMEMBERME &lt;/label&gt;
    &lt;input type="checkbox" name="chkSave" value="1" /&gt; 

    &lt;a href="&lt;?php echo base_url('forgotpassword/showlist');?&gt;" class="forgot"&gt;FORGOTPASSWORD?&lt;/a&gt;

    &lt;input type="submit" name="button" id="button" value="LOGIN" class="login"&gt;

&lt;/form&gt;
</code></pre>

<p>Please Help me how to assign the database name in controller and model in dynamically. </p>

<p>like this </p>

<pre><code>$config['hostname'] = "localhost";
$config['username'] = $client_db_username; // you got this from the 'admin' database
$config['password'] = $client_db_password; // you got this from the 'admin' database
$config['database'] = $client_db_name; // you got this from the 'admin' database
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";

$this-&gt;load-&gt;database($config);
</code></pre>

<p>A lot of the tables each database never change, and contain the same information.</p>

<p>I would like to have a main application database that contains this information, including a list of years and what there database is called. This database would then be used to select the correct year database..</p>