Hey im completely new to working with drupal, and i ran into a problem regarding storing the data a user have just submitted.
ive got my db table like this:
$schema['medarbejderkartotek'] = array(
'description' => 'TODO: please describe this table!',
'fields' => array(
'medarbejde_ID' => array(
'description' => 'TODO: please describe this field!',
'type' => 'serial',
'not null' => TRUE,
),
'Navn' => array(
'description' => 'TODO: please describe this field!',
'type' => 'text',
'not null' => TRUE,
),
),
'unique keys' => array(
'ID' => array('medarbejde_ID')
),
);
my form like this :
function sagsstyring_opret_medarbejder($form, &$form_state) {
$form['Medarbejder_navn']=array(
'#title'=> t('Indtast medarbejders navn'),
'#type'=> 'textfield',
'#required' => TRUE,
'#maxlength'=> 40,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Opret'),
);
return $form;
}
and my question is then, how my submit should be, in order to get the user input stored in the database ?
function sagsstyring_opret_medarbejder_submit($form, &$form_state) {
db_insert('medarbejderkartotek')
-> fields(array(
'Navn' => 'Medarbejder_navn',
))
->execute();