Drupal 7 hook_form_alter and submitting the form I added some custom field so that i can get more information when someone registers into the website but i want to alter one field on the form. I created a module which has a hook_form_alter function so that i can alter the field_first_name of the registration form. here is the code

function user_registration_form_alter(&amp;$form, &amp;$form_state, $form_id){
if ($form_id == 'user_register_form'){

    $form['field_first_name'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('First Name'),
        '#description' =&gt; t('Enter your first name.'),
        '#maxlength' =&gt; 255,
        '#required' =&gt; TRUE,
        );



}
if (isset($form['actions']['submit'])) {
 $form['actions']['submit']['#submit'][] ='user_registration_form_submit';
   }

}


I also created a the function which handles the form submission.

function user_registration_form_submit(&amp;$form, &amp;$form_state)
{


$fe_id = db_insert('field_revision_field_first_name')
    -&gt;fields(array(
        'field_first_name_value' =&gt; $form_state['value']['field_first_name'],
        ))-&gt;execute();
    drupal_set_message(t('your form entry has been added'));
}


My problem is that when i submit the form and i check the user details. i find that the first name details does not exist in the database or when i login as the administrator and click on the 'people' link. i find that all information is are submitted except the first name field which i am trying to alter. I also tried to submit the form without the form submit function but it still doesn't work.

and i get the following error message if i add the form_submit function


  Notice: Undefined index: value in user_registration_form_submit() (line 37 of /var/www/html/lite/sites/all/modules/user_regestration/user_registration.module).
  
  PDOException: SQLSTATE[HY000]: General error: 1364 Field 'entity_id'
  doesn't have a default value: INSERT INTO
  {field_revision_field_first_name} (field_first_name_value) VALUES
  (:db_insert_placeholder_0); Array ( [:db_insert_placeholder_0] => ) in
  user_registration_form_submit() (line 38 of
  /var/www/html/lite/sites/all/modules/user_regestration/user_registration.module).


THIS IS LINE 37 AND 38 OF MY CODE

'field_first_name_value' =&gt; $form_state['value']['field_first_name'],
))-&gt;execute();


I am creating the module on localhost first before i push it to the live website
There's a typo, change value to values

To get the user id use:

&lt;?php
global $user;
print $user-&gt;uid;
?&gt;