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
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
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.