<? php echo drupal_get_form ('pit_survey1'); flood_register_event ('survey_submit'); function pit_survey1 ($ formstate) { ....... foreach ($ questions as $ quest => $ answ) { $ form ['q'. $ i ++] = array ('# type' => 'radios', '# options' => $ answ, '# title' => $ quest); } $ form ['email'] = array ('# type' => 'textfield', '# title' => 'Email Address',' # prefix '=>' <div id = "emailh"> ',' # suffix '=>' </ div> '); $ form ['email1'] = array ('# type' => 'textfield', '# title' => 'Email Address'); $ form ['agree'] = array ('# type' => 'checkbox', '# title' => 'I agree to your needs, Admin !.'); $ form ['submit'] = array ('# type' => 'submit', '# value' => t ('Submit your answer')); $ form ['# redirect'] = 'thankupage.html'; return $ form; } function pit_survey1_validate ($ form, & $ formstate) { if ($ formstate ['values'] ['email']) form_set_error ('email', t ('it was treated as a spam robot. Get out!')); if (! flood_is_allowed ('survey_submit', 10)) form_set_error (null, t ('It seems to be a flooder. Get Out!')); } function pit_survey1_submit ($ form, & $ formstate) { foreach ($ formstate ['values'] as $ key => $ value) { if (preg_match ('~ ^ q \ d + $', $ key)) { $ out [] = $ form [$ key] ['# title']. ": \ t \ t \ t". $ form [$ key] ['# options'] [$ value]; } else { $ out [] = $ form [$ key] ['# title']. ": \ t \ t \ t". $ value; } } $ body = join ("\ n", $ out); $ msg = array ( 'id' => 'pit_survey', 'header' => array ('From' => 'survey@sdfsdfsfsd.dd'), 'to' => 'info+survey@sdfsdfds.dd', 'subject' => 'survey results', 'body' => $ body, ); if (drupal_mail_send ($ msg)) { // drupal_set_message (t ('Your submission was sent. Thank you.')); zakommencheno because by submission the user is transferred to the page with thanks. } }And so that we are not found at all, we will make this system a block and put it on the page with the text that precedes. Although, of course, it’s possible to have a sidebar in a very effective way. And QA with the code review team will not notice. ;-)
Source: https://habr.com/ru/post/88362/
All Articles