How to set up PHP form handling

jperreault's Avatar

jperreault

08 Feb, 2011 01:12 AM

Hi there,

First I just wanted to check that I have the correct URL. Is this the correct page to be following to set up form handling ( I wondered about the "DO NOT PUBLISH" :
http://www.hannonhill.com/kb/cast%20-DO%20NOT%20PUBLISH/form/index....

So I am trying to follow these instructions and I think there are some steps missing. Stop me if this is the wrong doc.

Here's what I've done, trying to set up a test:

Step2
create a data definition called form-config, paste the contents of form-config-data-definition.xml

Step3
create a new page in /test/files/form-config.xml
-- but first you need a content type ---- before that, you need to create a configuration set

create a configuration set called form-config
use default XML template
data type XML
output file extension: XML

Create a content type called form-config
configuration set : form-config
metadata: default
data definition: form-config

now you can create a new page called form-config.xml,
New->Default->Page
using content type form-config

Step4
Edit the page, for basic test clear all fields except 1 and 2

Step5
Publish the page

Create a new xml block called _internal/blocks/form-process
paste contents of form.php into the XML field

Create a new template with a region called <system-region name="PHPCODE"/>

You need adjust the full path to the form-config.xml

Step6
Create a new XSL FORMAT _internal/blocks/format/form-stylesheet
copy and paste contents of form-stylesheet.xsl

Step7
Create a new page for form processing
New->Default->Page
call it form-process
-- but first I need a new content-type, & configuration set -- create new configuration set form-process use template form-process
use type of data: HTML
use output file extension: .php
make configuration publishible

create new content type form-process
use config set: form-process
use metadata set: default

now create new page form-process
use content-type: form-process

publish form-process.php

Now I'm stuck, my form-process.php won't render:
An error occurred: An error occured during the parsing of the assembled page XML: org.xml.sax.SAXException: Ill-formed XML document (multiple root elements detected)

Am I on the right track?

Thanks,

Jeff

  1. Support Staff 1 Posted by Tim on 08 Feb, 2011 02:01 PM

    Tim's Avatar

    Hi Jeff,

    I don't think that particular page was meant to be published. Try taking a look at this page instead:

    Form Builder for Servers with PHP Enabled

    It should contain more up-to-date information.

    Let me know if that link helps.

    Thanks!

  2. 2 Posted by jperreault on 08 Feb, 2011 06:36 PM

    jperreault's Avatar

    Thanks Tim,

    This page is much better. If I may ask a few questions to get started, I want to try to set up the "hello world" version of a form that sends an email.

    Should the Form Config Content file be an xml file that never gets published to the site?
    Should the Form be a php file that does get published to the site?

    Normally, where would you put these files?
    I'm thinking the config belongs in our _internal/ directory
    and the Form belongs in it's own /form directory

    Ideally I would like to be able to create forms on pages throughout the site.

    Sorry for the questions, I'm used to using something like TFMail.

    Thanks,

    Jeff

  3. 3 Posted by jperreault on 08 Feb, 2011 11:13 PM

    jperreault's Avatar

    I've got it working now, thanks.

  4. Support Staff 4 Posted by Tim on 08 Feb, 2011 11:54 PM

    Tim's Avatar

    Perfect. Thanks for the update Jeff!

  5. Tim closed this discussion on 08 Feb, 2011 11:54 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac