I'm working with XML and PHP to populate a web form drop down box.
I have a html page
<!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> <header> <h1>Title</h1> </header> <form> <div id ="select xml"> <?php include 'dropdown.php'; ?> </div> </form> </body> </html> and I am hoping to include the following PHP to generate the actual box with the file names of the XML.
<?php //echo(substr(glob("xml/*.xml")[0],4)); echo "<p> <label>Select list</label><br> <select id = \"selectxml\"> <option value'0'>--Please Select--</option>"; $count = count(glob("xml/*.xml")); $files = glob("xml/*.xml"); for ($i = 0; $i < $count; $i++) { //echo(substr($files[$i],4)); //echo "<br>"; $filename = (substr($files[$i],4)); echo "<option value=$i+1>$filename</option>"; } echo "</select><br> <br> </p>"; ?> I'm aware the PHP isnt perfect, but it works.
The issue is that the Include HTML does not work when I run the page - any ideas?