PDA

View Full Version : html form that updates xml file?



hey_suburbia
February 16th, 2006, 07:22 PM
I have flash reading an XML file, which I manually edit every update:


<?xml version="1.0" encoding="iso-8859-1" ?>
- <Events>

<Event DateOf="2/18/2006" Type="0" Header="The Khyber" Content="V.I.P."/>

</Events>

I want my client to be able to just go to a "simple" html form that let's him edit:

"DateOf"
"Header"
"Content"

and hit submit/update

How should I go about this? THANKS!

antizip
February 17th, 2006, 11:14 AM
AJAX would be the way to go, tho i know it wouldnt be that 'simple' its the only way to go if all you want to use is html and javascript.

hey_suburbia
February 17th, 2006, 12:43 PM
Is there anything I can do with php/mysql? I'm familiar with them, not so much AJAX.

mBm
February 17th, 2006, 04:52 PM
i have a script that used in my CMS to export MENU LIST to XML from DB.

<?
$xml_file= '../menu_'.$_SESSION['ln'].'.xml';
$handle_xml = fopen($xml_file,'w');
$file_content = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>
<navigation>\n";
function toXML($menu_id=0,$level=0,$sub=0){
global $lang,$xml_file;
static $buf='';

if(is_writable($xml_file)){
$q_ = "SELECT * FROM menu";
$r_ = queryDB($q_);
for($i=0;$i<numrowsDB($r_);$i++){
$buf .= "<menu name=\"".printDBresult($r_,$i,"name")."\" href=\"";
if(printDBresult($r_,$i,"link")=='0'){
$buf .= "index.php?module=menu&sub=0&cmd=content&menu_id=".printDBresult($r_,$i,"id")."&smid=".printDBresult($r_,$i,"id");
}else{
$buf .= "index.php?cmd=redirect&url=".base64_encode(printDBresult($r_,$i,"link"))."&menu_id=".printDBresult($r_,$i,"id");
}
$buf .= "\" menu_id=\"".printDBresult($r_,$i,"menu_id")."\" id=\"".printDBresult($r_,$i,"id")."\" sub=\"".printDBresult($r_,$i,"sub")."\">\n".str_repeat("\t",$sub);
toXML(printDBresult($r_,$i,"id"),$level,printDBresult($r_,$i,"sub"));
$buf .= "</menu>\n";
}
}else{
$buf = 'Chmod '.$xml_file.' file to 0777.';
}
return $buf;
}
//echo $file_content.toXML().'-';
$file_content .= toXML()."</navigation>";
fwrite($handle_xml,$file_content);
echo '<div align="center">EXPORT SUCCESSFULLY</div>';
echo highlight_file($xml_file);
?>

mBm
February 17th, 2006, 05:01 PM
above script based on http://mng.cc/index.php?module=menu&cmd=content_more&id=28&mid=29&smid=29 .