473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

PHP Outputting XML file

I am trying to create an XML file using a PHP script. The XML File
looks something like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<ConsumerDirectXML>
<UserParams id="1" BrokerID="1"/>
<LoanParams>
<FirstLeinAmt>500000</FirstLeinAmt>
<ChooseProductTypeID>1</ChooseProductTypeID>
</LoanParams>
</ConsumerDirectXML>

The part that I don't understand is the following. I have a series of
checkboxes with each box having a different value. If a user were to
select 3 checkboxes I need to iterate through the array and write to
the ChooseProductTypeID field in the XML file as such,
<ChooseProductTypeID>1,5,7</ChooseProductTypeID>. I have been able to
print out the array variable $num using the following foreach loop:

foreach ($total as $num) {
print("$num,"); }

How would I get this string into the designated XML tag?

Currently I am able to write to this XML file using textboxes and the
following code for different XML tags in same file. How would I modify
what I am currently using for textboxes to use for the checkboxes while
utilitzing the foreach loop. Below is the method by which I am
writting to my XML file:

if ($node_name == "FirstLeinAmt") {
if ($value == $firstlein) {
// Do nothing
} else {
$fl_textnode = $child_obj->firstChild;
$new_firstlein = $doc->createTextNode($firstlein);
$child_obj->replaceChild($new_firstlein, $fl_textnode);
}
}
foreach ($total as $num) {
if ($node_name == "ChoosedProductTypeID") {
if ($value == $num) {
// Do nothing
} else {
$pt_textnode = $child_obj->firstChild;
$new_num = $doc->createTextNode("$num,");
$child_obj->replaceChild("$new_num", "$pt_textnode");
}}
....
Any help appreciated.

Aug 11 '06 #1
0 992

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jonathan | last post by:
I have a client solution that requires data and associated files to be stored with data in a database. As such, I have a situation where JPEG thumbnails/images that are stored as BLOBs (image...
5
by: Andrei Pociu | last post by:
I have a major doubt about outputting text in ASP .NET when using code behind. I know most of the output you gain from a code behind file (.aspx.cs) is outputted to the Webform (.aspx) using...
13
by: Jacek Dziedzic | last post by:
Hello! I have a piece of code that needs to display a formatted table of pointers using streams, with the pointers represented as hex values. It looks more or less like this: #include...
2
by: Andy | last post by:
Hi I'm really stuck outputting a double number to the console with three decimal places if the furthest right value is a zero. I can coutput the number 4.546 as 4.546 but then if I output...
2
by: cephelo | last post by:
I have no problems outputting the attribute value when the node is in context, for example, @id when an <status> node is in context. However, I am having trouble outputting it in a <xsl:value-of...
0
by: Heather Barber | last post by:
Hi So I'm fine with outputting to file from C#. But... as soon as I create an executable and move the file it no longer works - in fact it crashes due to security settings of some sort - whereever i...
4
by: Peter Nimmo | last post by:
Hi, I am writting a windows application that I want to be able to act as if it where a Console application in certain circumstances, such as error logging. Whilst I have nearly got it, it...
5
by: phong.lee | last post by:
Hello all, I was wondering if someone can assist me in outputting 6 reports into a pdf file? I created a macro that generates the 6 reports and right now it's saved as a snapshot on my drive. ...
3
by: mohaakilla51 | last post by:
Alright guys, I am working on a flashcard script... Previously I had it so that it onlty had predefined categories. People were complaining, so now I am trying to make it to where it reads...
12
by: billelev | last post by:
This is probably a very easy question to answer: I have been outputting some text to a message box, similar to the following: strOutput = "---" & Chr(10) & Chr(10) strOutput = strOutput &...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.