I will explain in details what I want to achieve first, and then I will post the code explaining and clarifying bit by bit for your understanding. in other words you will be able to see what can be done about the purpose or achievements i want to do.

What I want to achieve is:

First, I have three headings and within each of the three headings you will find different subheadings. The subheadings will only appears once an user click on any of the three headings when one heading is clicked on then the subheadings display downward. for example:

Illustration 1
Sneakers
  1. Nike
  2. Adidas
  3. Fila

Boots
DressShoes
Explanation of Illustration 1.


In this illustration there are three headings; Sneakers, Boots and DressShoes. The one clicked on is Sneakers and it shows or display a list of subheadings. In this case we have three subheadings Nike, Addidas and Fila. if you notice the others Headings stay closed containing its subheadings within because they haven't been clicked on. The set up of the code or what the code I have built so far does as fallows:

1- Enter the web address and the three headings appears

Sneakers
Boots
DressShoes
2-A user click on a heading in this case the Sneakers heading and it display the subheadings of that heading called Sneakers and leave the subheadings of that heading (Sneakers) displayed, If you notice the others heading stay closed containing its subheadings inside but not visible.

Sneakers
  1. Nike
  2. Addias
  3. Fila

Boots
DressShoes
3-From this point if a user click on any other heading let say Boots

Sneakers
Boots
  • Timberland
  • Deakers
  • Western Boots

DressShoes
4 Then the subheadings of the previous clicked on heading Sneakers disappear in other words close the previous heading along with its subheadings,
5-And then display the subheadings of the recent clicked on heading in this case Boots and leave it displayed. if you notice the Sneakers and DressShoes stay closed containing its subheadings inside but not visible to the users at this point.

Second part
My Purpose is:

The subheadings as I said will only display downward when you click on one of the headings which is ok. It display the subheadings and when I click on one of the subheading then it shows the content of the selected subheading in a table that I have styled to be at the right side of the page.
Illustration 2

Sneakers
  1. Nike
  2. Addias
  3. Fila

Boots
DressShoes
Explanation of the illustration 2 if for example the Nike subheading is clicked on then the content would displayed. The content would be placed in the table to the right of the page.
1-Air jordan
2-Air force
3-Air jordan D-Zero
4-Jordan true Flight Man
5-Lebroms Nike
As it display the content of the subheading *Nike it closes all the headings and comeback to the default state leaving the content of the *Nike display.

Illustration 3

leave the Displayed content of the *Nike subheading but .

1-Air jordan
2-Air force
3-Air jordan D-Zero
4-Jordan true Flight Man
5-Lebroms Nike
But the headings placed in a table at the left of the page comeback to the Default state.


Sneakers
Boots
DressShoes

in others words, it display the content of the subheading but it doesn't leave the subheadings displayed underneath the heading selected which in this case was Sneakers.So that if a user want to select or choose another subheading other than the *Nike subheading within the heading Sneakers, to display the content of any other desired subheading in the table placed to the right of the page, the user has to open the Sneakers heading again and choose any other subheading than the *Nike for instance *Adidas to see Adidas content.

Instead I want to display the headings as default just as it is, and once an user clicked on a heading then the subheadings underneath that heading display. Onto that point that's how the actual coding I have now is set up. But after that point I want the subheadings to display the content in the table styled at the right side of the web page and at the same time I want the subheadings underneath the clicked on heading in this case *Nike *Adidas *Fila to stay displayed and visible after an user click on one of the subheadings to display its content in the table, instead avoid the headings coming back to the default state which disappear all the subheadings underneath that subheading in this case Sneakers.

default state:

Sneakers
Boots
DressShoes

Sneakers
  1. Nike
  2. Addias
  3. Fila

Boots
DressShoes
Click on the *Nike subheading and it shows the content of *Nike but it comes
back to:

default state
Sneakers
Boots
DressShoes
Instead of leaving the subheading of the Heading Sneakers visible and still shows the content.

Sneakers
  1. Nike
  2. Addias
  3. Fila

Boots
DressShoes

1-Air jordan
2-Air force
3-Air jordan D-Zero
4-Jordan true Flight Man
5-Lebroms Nike
End of the purpose or what I want to achieve in php.

Third part

I have re-explained the purpose above enough, so that you guys can understand it without leaving doubts in your head. and If you still don't understand let me know I just here to clarify I need help.

Now that the purpose is clear let me explain the code set up I have so far.

PHP Code:
<?php

if(isset($_GET['shoesubject'])){
$sel_subject $_GET['shoesubject'];
$sel_shoe "";
} elseif(isset(
$_GET['shoe])){
$sel_subject = "";
$sel_shoe = $_GET['
shoe'];
}else {
$sel_subject= ""; 
$sel_shoe = "";
         
}

?>
These are the values I have (isset) on the top of the document. The $_GET variable which I understand function as a variable that scatter its values through out the whole document right?. That what I understand the $_GET variable does. As explain you the code you will see the values scattered through the document.

The next bit of code it's what fallows after I (isset) the variables
PHP Code:
<ul class="menu">
   <?php   
  $query 
"SELECT * 
                FROM menusubjects "
//headings are called on this query
                        
  
$menusubject_set mysql_query($query$connection);
  if(!
$menusubject_set){
  die(
"Database query failed:" mysql_error());
  }while(
$menusubject mysql_fetch_array($menusubject_set)){ // this while loop display the list of heading which are three 
  
echo "<li"
  if (
$menusubject["id"] == $sel_subject) {
  echo 
" class=\"selected\"";
  }
  echo 
"><a href=\"example1.php?subject=" urlencode($menusubject["id"]) ."\";>{$menusubject["Subject"]}</a></li>"
   
  
$query "SELECT * 
              FROM regularmenu  // these are the subheadings and they display beneath the headings
            WHERE menusubject_id = 
{$menusubject["id"]}";
            
  
$regularmenu_set mysql_query($query$connection);
  if(!
$regularmenu_set){die("Database query failed:" mysql_error());} 
  echo 
"<ul class=\"submenu\">"
  if (
$menusubject["id"] == $sel_subject) { // this if statement stays that the heading will only display the subheadings withing the next while loop 
  
while($rmenu mysql_fetch_array($regularmenu_set)){
  echo 
"<li"
  if (
$rmenu["id"] == $sel_menu) {
  echo 
" class=\"selected\""
  } 
  echo 
"><a href=\"example1.php?menu=" urlencode($rmenu["id"]) ."\";>{$rmenu["platename"]}</a></li>";  }
  } 
  
echo 
"</ul>"
  }
   
 
 
?>
 </ul> </table>
Now my final question is, where within this code I could place a condition where subheadings display its content and at the same time the subheadings stay displayed underneath the headings which is the final part of the purpose I described and detailed above.

There are a final part of the entire php code i have which contain a query that calls the content of the subheadings which will be displayed in a table found within this final part of the php code set up in this file, and it goes as follows:

PHP Code:
<?php $query "SELECT shoe.shoename, shoe.price, shoe.moreinfo 
FROM shoe
WHERE
shoe_kind = "
. (int) $_GET['shoe']; // $_GET value I extract it from the (isset) selection at the top of the code. This condition will show the content if the shoe_kind is == to $_GET value. I don't know if the query or purpose described above need a query to be place before this query or after this query and table found on this final part of my code.
echo $query 
$result 
mysql_query($query$connection);
while (
$content mysql_fetch_array($result)) {
echo 
"<table style=\"float:left\">
<td width=\"150\" style=\"text-align:center;\">" 
$row['shoename'] . "</td>
<tr>
<td height=\"100\" width=\"100\"   style=\"position:relative;\">
<img src=\"../images/shoesname.jpg\" alt=\"sd\" width=\"97\" height=\"80\"  border=\"1\" style=\"border-color:#FF6600;\" />
</td></tr>
<tr>
<td width=\"5\" height=\"21\" ></td><td>" 
$row['price'] . "</td>
</tr>
<td>" 
$row['moreinfo'] . "</td>
</table>"
;

?>
<?php
mysql_close($connection);
?>

Help please...
Again where could I locate a query and condition

where I Click on subheading in this case the *Nike subheading it shows the content of *Nike but instead of coming back to:

default state

Sneakers
Boots
DressShoes

Instead of leaving the subheadings of the Heading Sneakers visible and still shows the content like this.

Heading and subheadings in a table to the left of the page

Sneakers
  1. Nike
  2. Addias
  3. Fila

Boots
DressShoes
This is what display in the table at the right of the page

1-Air jordan
2-Air force
3-Air jordan D-Zero
4-Jordan true Flight Man
5-Lebroms Nike
Help please....