简体   繁体   中英

Create custom XML file from a wordpress form

I am building a WordPress website which would be need to integrate with an in-house CMS system through a simple custom XML file.

The client would like the users to submit a form in the WP website, and the form will send an email and will save on the server an XML file with a specific structure.

Is there any form plugin for WP which save an XML file on the server with form's details? If not - is there any form plugin with custom JS (to write the code myself)?

Thanks for all the answers...

Why would you need a plugin for that? You would complicate your own logic. You have a form. Its data gets send to a page (specified in the action attribute of your form tag). In this corresponding page, just insert your own little PHP logic to treat the data that was sent from the form, outputting XML tags for each of them (that should be very easy, contrary to what you seem to think). If you know what value corresponds to what tag (and you will need to know that even with a plugin!) then its a simple matter of adding < and > signs here and there + XML tags names... That done, just use wp_mail() to send your data to whatever email address you need to send it to + generate your XML file with saveXML or asXML (see here for examples : How to generate XML file dynamically using PHP? ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM