How can I generate a drop down menu from XML?
<portal>
<menu value="www....com" option="Text" />
<menu value="www....com" option="Text" />
<menu value="www....com" option="Text" />
<menu value="www....com" option="Text" />
<menu value="www....com" option="Text" />
</portal>
Something like that...
Something like this should generate the drop down:
<?php
require("MagicParser.php");
print "<select>";
function myRecordHandler($record)
{
print "<option value='".$record["MENU-VALUE"]."'>".$record["MENU-OPTION"]."</option>";
}
print "</select>";
MagicParser_parser("options.xml","myRecordHandler","xml|MENU/");
?>
You would then need to use JavaScript to actually make a form out of that which would redirect the user to another page or website...
Hi Dustin,
Can you post an example of the XML you are working with, and i'll try and put an example script together for you...
Use the <code> tags to post the XML in this forum so that it remains formatted correctly.