Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9061397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:28:28+00:00 2026-06-16T15:28:28+00:00

My website(D6) have Quick Enquiry Form(using webform) & i need to create a new

  • 0

My website(D6) have “Quick Enquiry Form”(using webform) & i need to create a new node simultaneously when user click the submit button in webform.

How do i get values from the webform and insert the values to the node when user click the submit button.

Please suggest me how to do this!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:28:29+00:00Added an answer on June 16, 2026 at 3:28 pm

    You can accomplish this by creating a custom module. The module will have two functions:

    1. HOOK_form_alter – to add an additional submit function to the existing webform.
    2. custom function – Custom function (called from HOOK_form_alter) to take the values from the submitted webform and create the node.

    Before you create the module, you should use the core node module and CCK to create a content type that contains all of the same fields as the webform.

    HOOK_form_alter

    In the example below, substitue the name of your module fir MODULENAME and the ID of your webform for XXX in the switch case. This function adds MODULENAME_create_node to your webform’s submit function array. We will define MODULENAME_create_node below.

    <?php
    function MODULENAME_form_alter(&$form, $form_state, $form_id) {
      switch ($form_id) {
    
        case 'webform_client_form_XXX' :
        $first = array_shift($form['#submit']);
        array_unshift($form['#submit'], $first, 'MODULENAME_create_node');
    
        break;
    
      }
    }
    

    MODULENAME_create_node

    This is the main function that will create the node.

    <?php
    function MODULENAME_create_node() {
      // Load all of the data submitted via the webform into a keyed array ($data)
      $data = array();
      foreach ($form_state['values']['submitted_tree'] as $key => $value) {
        $data[$key] = $value;
      }
    
      // The node_save() function (called later in this function) call
      // node_access_check, which means that anonymous calls to this function will
      // not be successful. Top get around this, we load user1 while executing this
      // function, then restore the user back to the original state at the end of
      // the function.
      global $user;
      $original_user = $user;
      $user = user_load(1);
    
      // Initialize the new node with default stuff
      $node = new stdClass();
      $node->type = 'YOUR_CONTENT_TYPE';
      $node->created = time();
      $node->changed = $node->created;
      $node->status = 1;
      $node->promote = 0;
      $node->sticky = 0;
      $node->format = 1;
      $node->uid = $user->uid;
    
      // You'll need to customize this based on what you named your webform and CCK fields.
      // Remember that all of the webform data is available and stored in the $data array.
      $node->title = $data['title'];
      $node->field_myfield1[0]['value'] = $data['myfield1'];
      $node->field_myfield2[0]['value'] = $data['myfield2'];
    
      //Save the node
      node_save($node);
    
      //Set the user state back to the original
      $user = $original_user;
    
    }
    

    You’ll also need to create an info file for your module. See Drupal’s documentation on writing info files if you’re not familiar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have website based on Umbraco 5. I have installed contact form plugin (http://cultivjupitercontact.codeplex.com/).
I have website where users can login with their Facebook account. I am using
On a website I have implemented the login using OpenID (based on StackOverflow). But
I have a php website like this: .---------------------. |title stats | | | |generate&display
I am creating a basic CMS website using Alfresco Web Quick Start. I want
I got a quick question, I am building an ASP.NET website and have a
Just a quick question, I am making user profiles for my website and would
I am new around here and I have a quick question if anyone can
I have a website that I've been asked to create a hierarchy diagram of.
Quick sum up: I have a social website where users can follow/post/vote etc. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.