I am developing bank loan application in drupal 7. In my first page there is a option to enter the loan amount then --> Search the available loan. In a second page(form) i need to display the available loan offers, interest, etc... based on the user entered value in page-1. Now i need to get the user entered value on page-2 and have to check with DB(Database) and then needs to display the results. Help me to get out the solution.


Store the loan amount in session when user submit the form1, and when rendering the form take that session value and display a suggestion field.

The code will be like below,

function form1_submit($form, &$form_state) {
  $_SESSION['loan_search_amount_field_value'] = $form_state['values']['loan_search_amount_field_name'];

function form2() {
  $form = array();
  $loan_amount = $_SESSION['loan_search_amount_field_value'];
  //db_query using $loan_amount
  //$db_result_array = db_query();
  $form['load_options'] = array(
    '#description' => t('Loan options'),    
    '#type' => 'select',
    '#title' => t('Field type'),
    '#options' => $db_result_array,
    '#size' => 2,
  return $form;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.