Answer the question
In order to leave comments, you need to log in
How to connect two forms to a function?
Hello everyone) There is a module for drupal, its task after submitting the form is to show the thank you page with the entered name in the form, it intercepts the name from the field with the key (imya_i_otchestvo). There was a need to connect another form to the module, but I don’t know how, since I’m not strong in php, tell me how to write the id of the second form in the module code?
<?php
function wf_custom_option_menu(){
$items = array();
$items['content/spasibo-za-zayavku'] = array(
'title' => '',
'page callback' => 'wf_custom_option_page',
'access callback' => TRUE,
);
return $items;
}
function wf_custom_option_form_alter(&$form, &$form_state, $form_id){
if($form_id == 'webform_client_form_44'){
$form['#submit'][] = 'wf_custom_option_submit';
}
}
function wf_custom_option_submit($form, &$form_state){
//$_SESSION['name'] = $form_state['values']['submitted']['name'];
$form_state['redirect'] = array('content/spasibo-za-zayavku', array(
'query' => array(
'imya_i_otchestvo' => $_POST['submitted']['imya_i_otchestvo'],
),
),
);
//debug($form_state['values']);
}
function wf_custom_option_page(){
if(!isset($_GET['imya_i_otchestvo'])){
drupal_goto('<front>');
}
else{
$output = '<div id = "senks"><div class = "black"><a>'.$_GET['imya_i_otchestvo'].', cпасибо за заявку.</a></div><div class = "red"><a>Менеджер свяжется с вами через 30 минут!</a></div></div>';
return $output;
}
}
Answer the question
In order to leave comments, you need to log in
This will make it clearer)
function wf_custom_option_menu() {
$items = array(
'content/spasibo-za-zayavku' => array(
'title' => '',
'page callback' => 'wf_custom_option_page',
'access callback' => true,
)
);
return $items;
}
function wf_custom_option_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'webform_client_form_44')
$form['#submit'][] = 'wf_custom_option_submit';
}
}
function wf_custom_option_submit($form, &$form_state) {
//$_SESSION['name'] = $form_state['values']['submitted']['name'];
$form_state['redirect'] = array(
'content/spasibo-za-zayavku',
array(
'query' => array(
'imya_i_otchestvo' => $_POST['submitted']['imya_i_otchestvo'],
),
),
);
//debug($form_state['values']);
}
function wf_custom_option_page() {
if (!isset($_GET['imya_i_otchestvo'])) {
drupal_goto('<front>');
} else {
$output = '<div id = "senks"><div class = "black"><a>' . $_GET['imya_i_otchestvo'] .
', cпасибо за заявку.</a></div><div class = "red"><a>Менеджер свяжется с вами через 30 минут!</a></div></div>';
return $output;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question