/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
module_load_include('inc', 'node', 'node.pages'); // new for Drupal 6 $form_state['values']['type'] = 'order'; // the type of the node to be created $form_state['values']['status'] = 1; // set the node's status to Published, or set to 0 for unpublished $form_state['values']['title'] = 'Some Node Title Here'; // the node's title //$product = $order=>products; //$variables = get_object_vars($product); //$keys = array_keys($variables); $form_state['values']['body'] = $order->products[0]->data['attributes'][2]; //drupal_set_message('<pre>'. print_r($order, TRUE) .'</pre>'); //drupal_set_message('<pre>'. .'</pre>'); // the body, not required $form_state['values']['name'] = 'jacobj'; $form_state['values']['op'] = t('Save'); // this seems to be a required value // call the function to create the node, node_revisions, and CCK values. // Replace "story" with the name of your form / content type $errs = drupal_execute('order_node_form', $form_state, (object) $nodeTmp);