Jump to content

HTML FORMS, PHP TO XML


panherz

Recommended Posts

Hi,

 

I have found myself in a bit of a cul-de-sac. Hope you can help as it is driving me crazy.

 

The scenario:

 

I have an html form (_post) which I would like to write the contents of to a one XML file using php.

 

The problem is:

 

The html page has three/four forms in it.

 

Form a = (submit a writes/updates only to section a)

Form b = (submit b writes/updates only to section b)

Form c = (submit c writes/updates only to section c)

 

Form d= (submit a, b, c writes/updates all sections)

 

The XML page has three sections a, b & c

 

To conclude, I want to be able to update the XML file in sections or update them all as a whole.

 

How can I go about achieving this?

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/262123-html-forms-php-to-xml/
Share on other sites

Have an hidden input field named section in each form:

 

<input type="hidden" name="section" value="a">

 

Then when processing check which section:

 

if ($_POST['section'] === 'a') {
    // section a processing
}

 

For the d part, let that be the else:

 

} else if ($_POST['section'] === 'c') {
    // section c processing
} else {
    // section d processing
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.