function formexample_nameform() { $form['first_name'] = array( '#title' => t('First Name'), '#type' => 'textfield', '#description' => t(''), ); $form['annotate']['nid'] = array( '#type' => 'value', '#value' => $node->nid ); $form['last_name'] = array( '#title' => t('Description'), '#type' => 'textfield', '#description' => t(''), );
$form['submit'] = array( '#type' => 'submit', '#value' => t('submit') );
return $form; }
function formexample_nameform_submit($form_id, $form_values) { global $user; print $nid = $form_values['annotate']; print $note = $form_values['first_name']; $description = $form_values['last_name']; /*db_query("DELETE FROM {contactus} WHERE uid = %d and nid = %d", $user->uid, $nid);*/ db_query("INSERT INTO {contactus} (uid, nid, name,description, timestamp) VALUES (%d, %d,'%s','%s', %d)", $user->uid, $nid,$note,$description, time()); drupal_set_message(t('Your contactus was saved.')); }
How to get the next nid,