2012-09-21 19:18
浏览 137


Ok so basically I've got a product database. members search the database by clicking on categories of their choice.

These categories are spans which all trigger a javascript (ajax) function which calls a php query to find all of the subcategories of the span just clicked.

Those subcategories are outputted in a while loop which creates more spans which also trigger the same js function which will link back to the query.

The code below shows the output of the categories displayed based on the output of the database query.

  "<div id=\"div1\">";
while($row = mysql_fetch_array($result))

echo " <span id=\"$spans\"         
onclick='serverconnect(\"http://localhost/dreamweaver/Website/webdev/Code structure.php\", 
\"nya\")'> $row[1] </span>";    
 echo "<br />";


So let's say the output of this is:


How could i pass the span names as values for the next query so that whatever span is clicked on gets its appropriate value passed to the database search?

Would i have to somehow assign the contents of each span to a variable and then pass the variable to the javascript function which would then pass it to the query?

Im out of ideas as to how to do that, or if i should do it another way.


1条回答 默认 最新

相关推荐 更多相似问题