Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic example of HTML form to XML document

Status
Not open for further replies.

spinbad

Technical User
Feb 1, 2006
3
US
Greetings,

Assume you have a 2 field HTML form, if you wanted to store the results of the form in an XML document how would you do it?

Target the XML document as the source of the form, and include the form names as element names in the XML document? Could i just use the form variable in the XML document? example:

HTML File:

<form method=post action=sample_file.xml>
<input name="field1" size="20"> <input name="field2" size="20">
<input type="submit" value="submit">

</form>

Target XML document:

<field1>$field1</field1>
<field1>$field2</field1>

Am I on the right track?
 
spinbad,

The browser will transmit the input fields in the HTML form using url encoding. It will be up to the target to parse through the name-value pairs and create the XML document.

Look to xforms to be able to transmit XML instance data when browser support becomes widely available.

Tom Morrison
 
Yes, Tom is right. To do it the way you are thinking would require XForms (which are great but limited browser support).

Presently, you have to use some server-side code (typically ASP or PHP) that will disect the name-value pairs data (either querystring or post data), then programmatically create the XML from this.

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top