What is the good way to pass a value from form creation function to its submit handler? I am newbie in Drupal, I have a query that i want to pass some value from form creation function to its submit handler.

Right now, I am saving that value in a form element of hidden type.

$form['product_nid'] = array(
 '#type' =&gt; 'hidden',
 '#value' =&gt; 12,
)


But this is not safe, anyone can change value on client side.
It is easy to do by using $form_state['storage'],

Just define $form_state['storage']['something'] = ;
This value will not show in browser and You will get this value in submit handler. see this code you will understand.

/**
 * Returns the form.
 */
function my_module_form() {
  return drupal_get_form('my_module_my_form');
}

/**
 * Returns the render array for the form.
 */
function my_module_my_form($form_state) {

  $form_state['storage']['product_nid'] = 12;

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; 'Save',
  );
}

/**
 * Add a submit handler/function to the form.
 *
 * This will add a completion message to the screen when the
 * form successfully processes
 */
function my_module_my_form_submit($form, &amp;$form_state) {
  $product_nid = $form_state['storage']['product_nid'];   
}