Multi-step PHP questionnaire in Drupal (for an expert system)

clairem - January 22, 2005 - 13:52

Without xstatic, is there any way of allowing POSTed data from a form to be passed through to a specialised script?

On our website, we need to build a small expert system. My colleague did this very effectively in PHP: it walks the user through a series of questions (difft paths depending on answer), before giving an analysis of the situation. After each step, the data is POSTed back to the script.

However, we couldn't see a way of doing this within Drupal, so the expert system runs outside Drupal (in a separate directory, with its own .htcaccess to prevent the request being thrown back into Drupal)

However, wanted it visually integrated with the rest of the site, so we eventually took the plunge and did a rather crude hack: used a few PHP include statements to load a header, masthead, footer etc to recreate the look-and feel of the main website.

Because we have only one theme, this works fine: we can't use multiple themes anyway, because our site is an informational one which doesn't allow users to login.

But it's a bit crude, and creates a few maintenance problems. Our custom theme is still under development, and when it is modified the included files have to be updated. This needs takes a little care because (for various reasons) we are not using base href in the expert system, so URLs have to start with root. Similarly, any changes in the main site's menu structure trigger a change in the include files.

So if it was possible without too much pain, I'd prefer to have the expert system properly integrated into Drupal.

It seems to me that the forthcoming xstatic module may provide a remedy, but even then I'm not sure -- I wonder if the POSTed data would be passed through to the expert system?

Is there any way of doing this without xstatic? Could it be done by writing a specialised module?

Survey module

robertDouglass - January 22, 2005 - 14:43

Another way might be to extend the survey.module. It currently allows you to specify the page to which it will navigate after a form has been completed. You could make this aspect dynamic and enter a callback function instead. Then the callback function could decide, based on the posted data, where to go to next.

- Robert Douglass

-----
visit me at www.robshouse.net

Survey is too constrained

clairem - January 22, 2005 - 15:48

Robert, thanks for the pointer.

I have played with survey.module, but it while it seems useful for some purposes (as long as you want to use Microsoft bloatware to analyse the data!), it is much too prescriptive for an expert system.

I can't see how the expert system could be helped by having to go through the survey constraints. All that would do would be to define the entry point: the underlying problem would still remain, except that the problem would be deferred for one step

any new development?

boytaichi - April 7, 2008 - 21:30

clairem,
i found your post a few years ago quite interesting. i'm looking for an expert system solution now. do you know of any new development?
thanks.

use nodeapi

robertDouglass - January 22, 2005 - 17:19

Are you aware of the nodeapi hook and how it is used? You could intercept your form submissions with the nodeapi and depending on the analysis fo the post data, use drupal_goto to get to the next logical step.

- Robert Douglass

-----
visit me at www.robshouse.net

 
 

Drupal is a registered trademark of Dries Buytaert.