I’m new to web development.I have a php file such as addcourse.php.In this file there is a code block in a form like this:
<select name="instructor-id" id="instructor-id">
<option > </option>
</select>
With this code user must select an instructor to add course to it.Instructor names must shown to user.I want to add elements to option tag from a xml file.Xml file has many instructors.(instructors.xml) Instructors that user can see with option tag must be from this instructors.xml file.I tried to get instructors with foreach in php tag but then i realized that option tag doesn’t work in php tag.I looked for a loop which can work in html but i couldn’t get any answers.What is the true way to solve this problem?Thanks for help.
Here you can user DOMDocument() class to get the all node values and attributes values.