how to get nid of a node when user is not on a node page
You'll want to Query the database for the nodes you need and then use the results of that query to populate the #options property. Something like this:

&lt;?php
    $result = db_select('node', 'n')
    -&gt;fields('n')
    -&gt;condition('type', 'node_type_name','=')
    -&gt;condition('status', 0,'&gt;')
    -&gt;execute()
    -&gt;fetchAssoc();
?&gt;


You can then use the results of that query easily since it comes back as an associative array. You'll want to specify exactly which fields you want (in your case, probably just title and node. See http://api.drupal.org/api/drupal/includes!database!database.inc/function/db_select/7 for how to do a proper select.