Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts

    Exclamation Ajax Noobie :) how do i get part of my page to correspond to my listbox value?

    Hi Guys,

    i am new at this ajax/javascript stuff but i would like to use it

    i have a drop down list with 5 values in it.

    entertainment
    computing
    electronics
    clothing
    misc

    and depending on that selected value i would like the following query to be run

    PHP Code:
        $stores = "SELECT *
                  FROM stores 
                  WHERE category = 'Electronics'";
        $query  = mysql_query($stores);
        
        while ($row = mysql_fetch_array($query)){?>
        
        <div class='storecontainer'>
        
        <div class='storeheader'>
        <?php echo $row['storeName'];?>
        </div>
        
        <div class='storeinfo_link'>
        
        <div class='storeimg'>
        <?php print '<img src="' $row['logo'] .'" alt="' $row['storeName'] .'" />';?>    
        </div>
        
        <div class='visitstore'>
        <a href="<?php print $row['storeLink'];?>"><img src="images/visitstore.gif" alt="Visit Store" title="Visit Store" border="0" /></a>
        </div> 
        
        </div>

        <div class='storedesc'>
        <?php echo $row['description'];?>
        </div>

        </div>
        <?php 
        
    }
        
    ?>
    now im not sure if this code is ok or if it will need to be translated into js? also the category = 'Electronics' bit of my statment will need to represent the current list value?

    can anyone help me get this sorted out, if it is at all possible

    many thanks
    Luke

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    ok i think i have sussed it? maybe lol, if i have thats the quicked i have done anything like this before, even if i have copied some code off w3schools and changed to hopeflly match what i want

    stand by... lol

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    WOW it actually works so chuffed

    w3schools rulzzzz!!! as well as you guys you rule too

    sweet so happy
    cheers
    Luke


  •  

    Posting Permissions

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