PDA

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


LJackson
05-20-2009, 10:23 PM
Hi Guys,

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

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

$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

LJackson
05-20-2009, 11:18 PM
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

LJackson
05-20-2009, 11:26 PM
WOW it actually works :D :D :D so chuffed :D

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

sweet so happy
cheers
Luke