I have created a Content Type called 'Project' using cck which defines all the fields I want in my form.

In order to change the form I have implemented Wim Leers' Ahah_helper module and extended hi demo to include a few more input fields and it's working very well.

However, I'm inserting the data into the tables by hand, doing INSERT INTO {node} in the ahah_helper_demo_form_submit function.

Surely that's not desirable?

Comments

davecoventry’s picture

After a few hours of googling it would appear that Drupal can take care of it's own housekeeping when it comes to adding nodes.

  $node = new StdClass();
  $node->type = 'job';
  $node->title = $form_state['values']['project_details']['title'];
  $node->body = $form_state['values']['body'];
  node_save($node);
  $nid=$node->nid;