ndesign.ie Posted March 30, 2010 Share Posted March 30, 2010 Ok this is little hard to grasp. What i have is a PHP page, first parsing the XML into an array and adding textfield and button to each entry. Problem is calling the function. I know how to but can't really grasp how to go about it. Code: <some parsing code> if(isset($_POST['SAVE_ME'])) { SAVE_ME(); } foreach($arfiles as $arFile) { $insXmlParser= new clsXmlParser($arFile); if($aArray=$insXmlParser->Parse()) echo LIST_CONTENTS($aArray); } function LIST_CONTENTS($arrayname,$tab="     ",$indent=0) { $retval=$currenttab=""; while(list($key, $value) = each($arrayname)) { for($i=0; $i<$indent; $i++) $currenttab .= $tab; if (is_array($value)) { $retval .= "<form action='<?=$_SERVER['PHP_SELF'];?>' method='post'>"; $retval .= "Element $value $currenttab$key $currenttab <input type=button name='$value$itemhht' value='UpDate $value$itemhht' onClick='SAVE_ME''></BR>$currenttab</BR>"; $retval .= LIST_CONTENTS($value,$tab,$indent+1)."$currenttab</BR>"; $retval .= "</form>"; } else $retval .= "$currenttab$key => <textarea name='$key$itemhht' id='$key$itemhht' cols=60 rows=1 value='$value'>${value}</textarea></BR>"; $currenttab = NULL; $itemhht++; } return $retval; } function SAVE_ME($arrayname,$indent=0) //this is the function needed to be run { for($i=0; $i<Count($aArray); $i++); if ($aArray[$i] == $_GET['$value$itemhht']) { echo $_GET['$value$itemhht']; } else echo $aArray[$i]; } any help/info/comments appreciated Link to comment https://forums.phpfreaks.com/topic/197026-php-xml-parser-with-array/ Share on other sites More sharing options...
teamatomic Posted March 30, 2010 Share Posted March 30, 2010 Try it this way: echo LIST_CONTENTS($aArray,$tab=" ",$indent=0); } function LIST_CONTENTS($arrayname,$tab,$indent) { HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/197026-php-xml-parser-with-array/#findComment-1034402 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.