Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- custom_my_form($form, &$form_state) {
- $form['user_firstname'] = array(
- '#type' => 'textfield',
- '#title' => 'ID',
- );
- $form['user_email'] = array(
- '#type' => 'textfield',
- '#title' => 'Email',
- );
- $form['user_pwd'] = array(
- '#type' => 'password_confirm',
- '#required' => TRUE,
- );
- $form['submit_button'] = array(
- '#type' => 'submit',
- '#value' => 'Submit',
- );
- return $form;
- }
- function custom_my_form_submit($form, &$form_state) {
- //Here it is working fine,
- $fname = md5($form_state['values']['user_firstname']);
- $email = md5($form_state['values']['user_email']);
- $pwd = md5($form_state['values']['user_pwd']);
- $values = array(
- 'Form_Req' => array(
- 'Header' => array(
- 'Info' => 'xyz',
- ),
- 'Body' => array(
- 'Type' => 'FromSubmit',
- 'firstName' => $fname,
- 'lastName' => $email,
- 'emailId' => $pwd
- )
- )
- );
- $json = json_encode($values, JSON_UNESCAPED_SLASHES);
- $options = array(
- 'headers' => array(
- 'Content-Type:application/json',
- ),
- 'method' => 'POST',
- 'data'=> $json,
- );
- drupal_http_request('http://example.com', $options);
- }
Add Comment
Please, Sign In to add comment