The normal way to handle this is to implement a multi-step workflow. See drupal_rebuild_form()
for more information, but basically you set $form_state['rebuild'] = TRUE;
in your submit handler, and in the original form function add a check to see if the form's been submitted. If it has, you have access to the submitted values and can manipulate the form as you see fit.
A very basic example:
function MYMODULE_some_form($form, &$form_state) {
// If the form has been submitted, output something related to the submission
if (!empty($form_state['values']['some_field'])) {
$form['submission'] = function_to_do_something_with_value($form_state['values']['some_field']);
}
else {
// Otherwise build the normal form
$form['some_field'] = array(
'#type' => 'textfield',
// ...
);
}
return $form;
}
function MYMODULE_some_form_submit($form, &$form_state) {
$form_state['rebuild'] = TRUE;
}