malanno Posted March 11, 2016 Share Posted March 11, 2016 Hi. My goal is to have a form that updates an xml.file... Can I create a form that would automatically know what the field names are? For instance the hardware engineers I work with don't even close to html forms and php so they want to be able to just change a node name or even add and subtract nodes, however they don't want to touch the code for the form/ The hardware engineer that gave me this task call it... Self Defining Entry Fields Anyone ever hear of that? Here are my xml and xsl sheet.... It's kinda like the xsl <xsl:template match="/"> <html> <body> <form method="post" action="test.php"> <h2>Customer Information:</h2> <table border="0"> <xsl:for-each select="/customer/location/field"> <tr> <td><xsl:value-of select="@id"/></td> <td> <input type="text" size="50"> <xsl:attribute name="id"> <xsl:value-of select="@id" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="@id" /> </xsl:attribute> <xsl:attribute name="value"> <xsl:value-of select="value" /> </xsl:attribute> </input> </td> </tr> </xsl:for-each> </table> The xml looks like this <location> <field id="Name " name="name "> <value>MHV </value> </field> <field id="City " name="city "> <value>Lake Katrine </value> </field> <field id="State " name="state "> <value>NY </value> </field> <field id="ZIP " name="zip "> <value>12449 </value> </field> <field id="Email Addresses" name="email_addresses"> <value>hupcey@cadence.com berghorn@cadence.com </value> </field> </location> If you notice the xsl does not need the field names, Just the child node location. How can I make this work the same way with an html form? Thank you... customer.xml Link to comment Share on other sites More sharing options...
Ingolme Posted March 12, 2016 Share Posted March 12, 2016 It looks like your XSL works. Are you asking how to do this with PHP? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now