tezread
09-29-2006, 02:21 PM
1) Script Title: Switch Menu
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm
3) Describe problem:
I am trying to adapt this approach so that the menu items are listed using a PHP query and when clicking a menu item the records relating to it are displayed. Perhaps this will best be demonstrated through a page on my website:
http://www.mindseyemidlands.co.uk/elearningcourses.php
In my case I would like a list of quality systems to be the 'menu items' and when you click the menu item the details relating to it are 'expanded'.
Here is my PHP query that at present lists the quality systems.
include("connect.php");
$sql = "SELECT quality_name FROM qualityadmin WHERE category ='List A Generic Standards'";
$result = mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
echo '<a href="qualitysystem_summary1_details.php?quality_name='. urlencode($row[0]) .'">'. $row[0] .'</a><br><br>';
}
and here is the resulting query after clicking the chosen quality system
if (isset($_GET['quality_name'])) {
include ("connect.php");
$course = mysql_real_escape_string($_GET['quality_name']);
$res = "SELECT * FROM qualityadmin WHERE quality_name = '$quality_name'";
$result = mysql_query($res) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
// begin output here:
echo '<style type="text/css">
#myTable td {
font-family:arial, helvetica, sans-serif;
font-size: 14px;
}
.heading {
background:#eee;
color: #0000cc;
}
</style>
<table cellpadding="2" cellspacing="0" border="1" id="myTable" width="700px">
<tr>
<td class="heading" colspan="3" fontsize= "18px">Quality Name</td>
</tr>
<tr>
<td colspan="3">' . $row['quality_name'] .'</td>
</tr>
<tr>
<td class="heading" colspan="4">Authority Body</td>
</tr>
<tr>
<td colspan="3">' . $row['authority_body'] . '</td>
</tr>
<tr>
<td class="heading">Address 1</td>
<td class="heading">Address 2</td>
<td class="heading">Town</td>
</tr>
<tr>
<td>' . $row['address1'] . '</td>
<td>' . $row['address2'] . '</td>
<td>' . $row['town'] . '</td>
</tr>
<tr>
<td class="heading">Postcode</td>
<td class="heading">Telephone</td>
<td class="heading">Email</td>
</tr>
<tr>
<td>' . $row['postcode'] . '</td>
<td>' . $row['telephone'] . '</td>
<td>' . $row['email'] . '</td>
</tr>
How can I incorporate these queries so they function like the switch menu on Dynamic?
Thanks in advance
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm
3) Describe problem:
I am trying to adapt this approach so that the menu items are listed using a PHP query and when clicking a menu item the records relating to it are displayed. Perhaps this will best be demonstrated through a page on my website:
http://www.mindseyemidlands.co.uk/elearningcourses.php
In my case I would like a list of quality systems to be the 'menu items' and when you click the menu item the details relating to it are 'expanded'.
Here is my PHP query that at present lists the quality systems.
include("connect.php");
$sql = "SELECT quality_name FROM qualityadmin WHERE category ='List A Generic Standards'";
$result = mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
echo '<a href="qualitysystem_summary1_details.php?quality_name='. urlencode($row[0]) .'">'. $row[0] .'</a><br><br>';
}
and here is the resulting query after clicking the chosen quality system
if (isset($_GET['quality_name'])) {
include ("connect.php");
$course = mysql_real_escape_string($_GET['quality_name']);
$res = "SELECT * FROM qualityadmin WHERE quality_name = '$quality_name'";
$result = mysql_query($res) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
// begin output here:
echo '<style type="text/css">
#myTable td {
font-family:arial, helvetica, sans-serif;
font-size: 14px;
}
.heading {
background:#eee;
color: #0000cc;
}
</style>
<table cellpadding="2" cellspacing="0" border="1" id="myTable" width="700px">
<tr>
<td class="heading" colspan="3" fontsize= "18px">Quality Name</td>
</tr>
<tr>
<td colspan="3">' . $row['quality_name'] .'</td>
</tr>
<tr>
<td class="heading" colspan="4">Authority Body</td>
</tr>
<tr>
<td colspan="3">' . $row['authority_body'] . '</td>
</tr>
<tr>
<td class="heading">Address 1</td>
<td class="heading">Address 2</td>
<td class="heading">Town</td>
</tr>
<tr>
<td>' . $row['address1'] . '</td>
<td>' . $row['address2'] . '</td>
<td>' . $row['town'] . '</td>
</tr>
<tr>
<td class="heading">Postcode</td>
<td class="heading">Telephone</td>
<td class="heading">Email</td>
</tr>
<tr>
<td>' . $row['postcode'] . '</td>
<td>' . $row['telephone'] . '</td>
<td>' . $row['email'] . '</td>
</tr>
How can I incorporate these queries so they function like the switch menu on Dynamic?
Thanks in advance