drupal - how to add fields to database using hook functions and how should i write a return function -


i added fields mobile no,landline no, using below code form created registration module. when fill fields along 2 added fields , submit them clicking save registration button.i cannot find 2 added field in database.how can make them appear in database.

function search_enhance_form_alter(&$form, $form_state, $form_id) {  if($form_id == 'registration form') {   $form['mobile no'] = array(   '#type' => 'fieldset',   '#title' => t('mobile no'),   '#collapsible' => true,   '#weight' => 30, ); $form['mobile no']['text'] = array(   '#type' => 'textfield',   '#description' => t('this test see form_alter hook in action1.'), );  $form['text'] = array(   '#type' => 'textfield',   '#description' => t('this test see form_alter hook in action.'),   '#title' => t('land line no'),   '#weight' => 10, ); }          } 

hooks (your) functions executed before/after specific code executed. i.e. "hook_user_login" called when user logged in.

you can place hook functions in module or in theme template file. i.e. if module has name "test" should name hook function "test_user_login" drupal can find , execute when needed. so, instead of "hook" should place name of module/theme.

next, after adding hook function should clear cache (configuration -> development -> performance in admin menu).

you can use hook functions stuff when occurs, hooks allowing change values passed code executed after hook in process.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -