I wish to write Drupal Form value produced from API Form, to my database using the following code: Into my database only seems 1 and absolutely nothing more. Wrong? Thanks!

$sql= "INSERT into {test} (id, studiejaar, opleiding, soortStage,
        stageplaats,periodes)VALUES(1, '%s', '%s', '%s', '%s', '%s')";
db_query($sql, $form['studiejaar']['#value'], $form['opleiding']['#value'], $form['soortStage']['#value'],
            $form['stageplaats']['#value'], $form['periodes']['#value']);
  • First, use $form_condition['values']['studiejaar'] and so forth rather than $form.

  • You most likely should not specific the id, rather, just leave that away and MySQL will instantly increment the worthiness.

  • For those who have defined your table with hook_schema() (what you ought to do!), you might use drupal_write_record().