How to display the values after submit in drupal 7 I have a three form fields like Name,phone,email now after inserting the values in my db i want to display the values into same page or another page like
 Name:XXXXXXXXXXX
 Phone:5545445454
 email:yyy@some.com

how can do this in drupal7
You can use the function hook_form_FORM_ID_alter to do that.

Just replace the FORM_ID with the ID of your form.
Lets say the id of the form is my_custom_form, then the values could be printed as,

function MODULE_form_my_custom_form_alter(&amp;$form, &amp;$form_state, $form_id){
  //add a new function(submit handler) on submit button.    
  $form['#submit'][] = 'new_submit_function';
}

function new_submit_function(&amp;$form, &amp;form_state) {
  // the $form_state['values'] array contains all the 
  // values from the fields of the current form stored in it
  drupal_set_message("name : " . $form_state['values']['name']);
  drupal_set_message("phone : " . $form_state['values']['phone']);
  //and so on.
  //the message will be displayed on the page after form submit
}


If you are not sure how to find the id of the form, then use hook_form_alter to do that, e.g.

function MODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  drupal_set_message($form_id);
}


this would print the form id of every form you are on, so that you can use the id of the form you wish to change and perform a hook_form_FORM_ID_alter to change anything you wish :-)