I have been designing a module that will allow you to create project categories, assign tasks into the projects with owner information, start and end dates, notes, etc. I wrote a small search function to let you go through the db by any of the fields.
I am having an issue passing some values from the page through to my search function.
Right now, I have a form page called search_page:
function search_page() {
//Builds the array of project names for the project select field
$query = "SELECT DISTINCT project_id, project_name FROM qatask_project ORDER BY project_name";
$projectlist = db_query($query);
$options = array();
$options[0] = 'None';
while ( $data = db_fetch_object($projectlist) ) {
$options[$data->project_id] = t($data->project_name);
}
//Builds the array of user names for the owner select field. Users MUST be in the role of QATask user.
$query2 = "SELECT u.uid, u.name FROM users u, users_roles, role WHERE u.uid = users_roles.uid
and role.rid = users_roles.rid and role.name like 'QATask user'";
$ownerlist = db_query($query2);
$options2 = array();
$options2[0] = 'None';
while ( $data2 = db_fetch_object($ownerlist) ) {
$options2[$data2->uid] = $data2->name;
}
$form['search_task'] = array( '#type' => 'fieldset', '#title' => t('Search Task Datebase'), '#tree' => TRUE,);
$form['search_task']['project_name'] = array( '#type' => 'select', '#title' => t('Project Name'),
'#default_value' => $options[0], '#options' => $options,);
$form['search_task']['owner_name'] = array('#type' => 'select', '#title' => t('Task Owner'),
'#default_value' => $options2[0], '#options' => $options2,);
$form['search_task']['task_name'] = array( '#type' => 'textfield', '#title' => t('Task Name'),
'#default_value' => t(''), '#size' => 60, '#maxlength' => 100,);
$form['search_task']['start_date'] = array( '#type' => 'date', '#title' => t('Start Date'),);
$form['search_task']['end_date'] = array( '#type' => 'date', '#title' => t('End Date'),);
$form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
return drupal_get_form('search_task', $form, $form_id);
}