Also, you kept saying "database" so I assume you want to store the values in the database.
In the database table, I'd use a "blob" field to store the data.
For multi-page forms, I'd either track the variables in session variables or if cookies aren't set, you'll need to either use URL cookies (really ugly)
or save the inter-page variables in a temporary variables' table.
If a temporary table, I'd opt for serializing the values keyed on the form id and ip address of the visitor.
(see: php's serialize() and unserialize() functions)
The temporary variables table uses a blob field also for the serialized values and the structure would be something like:
form_id (varchar(16)), ip_addr (char(15) for ipv4), variables (blob).
You've provided very little on the program structure, so I really can't help beyond the former and the following.
(I can't do your work for you.)
What is the logic of saving a new XML page?
Do you know how to create an XML page by just using code?
Why don't you just create a custom XML wrapper?
Maybe something like:
Or something simpler?
Example: