Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Edit XML with PHP Re: Edit XML with PHP

#78087

Thanks for the reply. I just want to make this form functional. It already loads in data from my XML file. But I want the user to be able to edit it with this form. So since it loads the information in from the xml file, I could just dump all of the XML data and replace it with the new data that are in the fields when it is saved. I would assume this is all done with PHP. This is my xml file currently:

Code:
Package 1 $750 This is a description for Package 1. Package 2 $1250 This is a description for Package 2. Package 3 $1750 This is a description for Package 3. Package 4 $2000 This is a description for Package 4. Package 5 $3000 This is a description for Package 5.

This is the code I wrote for the wordpress admin menu as seen above:

Code:

Edit Pricing

load( ‘http://www.condiffphotography.com/pricing.xml’ );

$pricing = $doc->getElementsByTagName( “package” );
foreach( $pricing as $package )
{
$titles = $package->getElementsByTagName( “title” );
$title = $titles->item(0)->nodeValue;

$prices = $package->getElementsByTagName( “price” );
$price = $prices->item(0)->nodeValue;

$descriptions = $package->getElementsByTagName( “description” );
$description = $descriptions->item(0)->nodeValue;

echo ”

Package:






$description

“;
}
?>




So looking at that image in my last post, PHP would take each box and write a <package> node, for each box, in the xml file when you click save.

I just need to figure out how to write this with PHP. Does that make more sense?