I am encountering a strange problem when trying to create two dropdowns where the values are loaded from two different arrays. The problem is I can see only one dropdown and at the end of the list I see the label of the next dropdown, finally it is also not showing any submit button which I have created after the dropdown lists.
Let me make it clear with some code and screenshots, so that one can have an idea:
if($output_form == 1){
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>ID</label>
<input type="text" name="ID" /><br /><br/>
<label>Name</label>
<input type="text" name="name" /><br /><br/>
<label>Upload1:</label>
<input type="file" name="upload1" /><br />
<label>Upload2:</label>
<input type="file" name="upload2" /><br />
<label>Catalogue</label>
<select name="cataloguepdfs" />
<?php
foreach ($catalogueArray as $cataloguePDFName) {
echo '<option value="'. $cataloguePDFName . '">' . $cataloguePDFName . '<option />';
}
?>
<label>Template</label>
<select name="templatepdfs" />
<?php
foreach ($templateArray as $templatePDFName) {
echo '<option value="'. $templatePDFName . '">' . $templatePDFName . '<option />';
}
?>
<input type="submit" name="submit" value="Submit">
</body>
</html>
<?php
}
?>
Here is the screenshot for the above code. Please note that the rest of my code is working good, fetching the .pdf file names from the respective arrays. Please note that my pdfs are named 1.pdf, 2.pdf and so on
On the other hand if I move the template dropdown list above the catalogue dropdown list it is the other way round with 'Catalogue' as the end element in the dropdown list.
If there is only dropdown list everything works fine including the presence of the submit button.
Is there a way how I can display both the dropdowns after populating them from respective arrays. Is there some problem with my code. Any help would be appreciated.
Thanks