SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with a while loop inside a if statement.

    I need the items and the subject menu to stay weather the users click in a item or not.

    The code below shows the shoe kind (subjectmenu) and below it the shoes of that kind appear padding-left:20px ten pixels more to the right than shoekind table(submenu). I have set it up that way so the users can see and identify the shoes by its kind.
    It hides the shoes inside the shoekind field or Subjectmenu and the shoes will only be visible if users click on the shoekind field. Once they click on the subjectmenu all the shoes comes to visibility and users will be able to choose what shoes they want. onto that point everything works good in the code below. But when users click in the shoe or a submenu then it shows the shoes in a table to right of the screen which I have set up, but at the same time the shoekind field hides all the shoes again instead of leaving displayed the shoes under the shoekind field regardless the users clicked on one shoe under it. I want it to still displaying the shoes even though users click on one of the shoes. Again The code below hides shoemenu inside shoekind once click on a shoekind display the shoes available and once I click on a shoes it hides all the shoes again inside the shoekinc or menusubject and instead of hiding the s hoes I want then to stay whether a users click on one or not.

    How can I arrange the coding so it display the shoes below the shoekind field and leave whether a users click on an item (shoe) or not.

    Help Please
    PHP Code:
       
      $query 
    "SELECT * 
                  FROM shoes 
                WHERE kind_id = 
    {$menusubject["id"]}";
      
    $shoes_set mysql_query($query$connection);
      if(!
    $shoes_set){
      die(
    "Database query failed:" mysql_error());} 
    echo 
    "<ul class=\"shoecategories\">";
      if (
    $shoekind["id"] == $sel_shoe['id']) {
      while(
    $rshoe mysql_fetch_array($regularshoe_set)){
      echo 
    "<li"
      if (
    $rshoe["id"] == $sel_shoe) {
      echo 
    " class=\"selected\"";
      } 
      echo 
    "><a href=\"shoe1.php?menu=" urlencode($rshoe["id"]) ."\";>{$rshoe["shoename"]}</a></li>";  }
      }
      

       echo 
    "</ul>"
    Last edited by co.ador; May 13, 2009 at 07:34.

  2. #2
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's a lot of information that's still missing here. Could you repost the whole script? And perhaps do a step-by-step explanation of exactly what you'd like to see?

  3. #3
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Situationsoap!

    I post it after I finish writing it.

  4. #4
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    decided to empty this post to add some more missing code to the one below.


    ===============>
    Last edited by co.ador; May 13, 2009 at 13:52.

  5. #5
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank you This is the rest of the code I was missing for your understanding guys.

    Thank you This is the rest of the code I was missing for your understanding guys.
    This Is the rest of the code along with the explanation above repeated and contains two queries.


    The first query

    PHP Code:
    $query "SELECT *
             FROM shoeskind "

    calls the subject or shoeskind.


    The second query

    PHP Code:
    $query "SELECT * 
                  FROM shoes 
                  WHERE kind_id = 
    {$menusubject["id"]}"

    calls the submenu inside the shoeskind table and it will only shows if kind_id = to the menusubject[id].

    The only thing is that I need the items and the subject menu to stay weather the users click in a item or not.

    The code below shows the shoe kind (subjectmenu) and below it the shoes of that kind appear padding-left:20px ten pixels more to the right than shoekind table(submenu). I have set it up that way so the users can see and identify the shoes by its kind.
    It hides the shoes inside the shoekind field or Subjectmenu and the shoes will only be visible if users click on the shoekind field. Once they click on the subjectmenu all the shoes comes to visibility and users will be able to choose what shoes they want. onto that point everything works good in the code below. But when users click in the shoe or a submenu then it shows the shoes in a table to right of the screen which I have set up, but at the same time the shoekind field hides all the shoes again instead of leaving displayed the shoes under the shoekind field regardless the users clicked on one shoe under it. I want it to still displaying the shoes even though users click on one of the shoes. Again The code below hides shoemenu inside shoekind once click on a shoekind display the shoes available and once I click on a shoes it hides all the shoes again inside the shoekinc or menusubject and instead of hiding the s hoes I want then to stay whether a users click on one or not.



    PHP Code:
    <ul class="menu">
       <?php   
      $query 
    "SELECT * 
                FROM shoeskind "
    ;
                            
      
    $menusubject_set mysql_query($query$connection);
    if(!
    $menusubject_set){die("Database query failed:" mysql_error());}
    while(
    $menusubject mysql_fetch_array($menusubject_set)){
       echo 
    "<li"
    if (
    $menusubject["id"] == $sel_subject) {
       echo 
    " class=\"selected\"";}
       echo 
    "><a href=\"shoe1.php?subject=" urlencode($menusubject["id"]) ."\";
                 
    {$menusubject["Subject"]}</a></li>";    

      
    $query "SELECT * 
                FROM shoes 
                 WHERE kind_id = 
    {$menusubject["id"]}";
      
    $shoes_set mysql_query($query$connection);
    if(!
    $shoes_set){ die("Database query failed:" mysql_error());} 
       echo 
    "<ul class=\"shoecategories\">";
    if (
    $shoekind["id"] == $sel_shoe['id']) {
    while(
    $rshoe mysql_fetch_array($regularshoe_set)){
       echo 
    "<li"
    if (
    $rshoe["id"] == $sel_shoe) {
       echo 
    " class=\"selected\"";} 
       echo 
    "><a href=\"shoe1.php?submenu=" urlencode($rshoe["id"]) ."\";>{$rshoe["shoename"]}</a></li>";}
      }echo 
    "</ul>";


    // the table below is where the shoes and info display once the users click on a submenu..
    <table width="40%" border="0" cellspacing="0" cellpadding="0" bordercolor="#FF0033" bgcolor="#FFFFFF" id="shoetable">
    <?
    php $query "SELECT shoe.shoename, shoe.price, shoe.moreinfo 
    FROM shoe
    INNER 
    JOIN shoe_kind 
    ON shoe.kind_id=shoe_kind.kind_id"

    $result mysql_query($query$connection);
    while (
    $row 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>"
    ;

    ?></table>
    How can I arrange the coding so it display the shoes below the shoekind field and leave whether a users click on an item (shoe) or not.

    Help Please


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •