I am attempting to use … to load data onto a web page, so when an option is selected, the relevant data appears on the page. So far, I have one piece of data displayed, but none of selected options change this.
This is the PHP:
<form name="form" method="post" action="#">
<?php
$select_tag = "<select onchange='reload(this.form)'>";
$select_tag .= "<option>test one</option>";
foreach ($data as $output)
{
$select_tag .= "<option>" . $output['header'] . "</option>";
}
$select_tag .= "</select>";
?>
<?php echo $select_tag; ?>
<br>
<button type="submit" value="submit">Submit</button>
</form>
<?php echo $output['pages']; ?>
The database contains for test data items, but when the page is loaded, the fourth item is shown. I guess this has to do with the code I am using.
I am connecting to the database using PDO if that helps.
So, how do I get the data for page 1, 2, 3, and 4 to show when selected.
Thanks in advance for any help.