Custom coding: Advanced Webform Confirmation Pages

In 3.x and newer versions of Webform, the use of PHP validation and processing is deprecated because it's unsafe, but you can do whatever you need to within a custom module. Here are the most important parts you'll need for your module to communicate with your webform and validate or process the data available to webform.

In this example, I have a webform that allows visitors to register for an event. After the user submits the form, it they receive a confirmation page that uses some of the submitted data. It prints an ID and sends an email with the same information. I'll be using the 7.x version for this example but if you know how to code, you'll have no problems downgrading to 6.x-3.x

The first step is to create a hook_menu with the callback to hold the confirmation page:

<?php
function reg_menu() {
  	$items['register/confirmation/%/%'] = array(
		'page callback' => 'reg_confirmation_page',
		'page arguments' => array(2, 3),
		'access arguments' => array("access content"),
		'type' => MENU_CALLBACK,
		'title' => 'Confirmation',
	);

        return $items;
}

?>
Subscribe with RSS Subscribe to RSS - confirmation pages