I'm creating currently database with tables and trying to do it using second normalization form for my school.
I have list of institutional partners which has to be displayed in two tables. I got this far that I have created database tables: The first one called "as_partners_id" which contain columns: "Partner_ID" (this is primary key INT) and "Partner" (just a VARCHAR). The other table called "as_partners" has some more columns, like: "Partner_ID, Country, EU terms, NON-EU terms, More info".
What I want to do is create drop down menu above first table from which you can choose ID from e.g. 1 to 30. After picking it will display the second table with more information about this particular ID. But I actually don't know how to do it properly. Here is the code that I have so far:
<?php
// Create connection
$con=mysqli_connect("localhost","easj_admin","","easj");
// Check connection
if (mysqli_connect_errno())
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
} else {
echo "We are connected.";
}
$result = mysqli_query($con,"SELECT Partner_ID, Partner FROM as_partners_id");
?>
BODY PART:
<table>
<tr>
<?php
// Get field information for all fields
while ($fieldinfo=mysqli_fetch_field($result))
{
echo "<th>" . $fieldinfo->name ."</th>";
}
echo "</tr>";
// <form>
// <input typ="select">
// </form>
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Partner_ID'] . "</td><td>" . $row['Partner'] . "</td>" ;
echo "</tr>";
}
?>
</table>
How can I add to my code this drop down menu that will display the second table called as_partners? Please help.