SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 14th, 2004, 07:33 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Dynamic Select Box

Dear All:

Dear All:

Anybody could advices me on this.

On my page, there are 2 option selector. 1 for category and 1 for subcategory.

The category option selector coding as below:

<SCRIPT LANGUAGE="JavaScript">
function CategorySelected(form)
{

// dynamic subcategory select box

}
</script>
<form name=f1 method=post action="act_uploadpic.php" enctype=multipart/form-data target=_self >
Picture Name: <input type=text maxlength=25 name=pname size="50"><br>
<input type=hidden name=PIC_FILE_SIZE value=100000>
Category: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SELECT NAME=category ONCHANGE="CategorySelected(this)";>


php Code:
Original - php Code
  1.  
  2. php include("list_var.php");
  3.  
  4. $db = mysql_connect($server,$dbuser,$dbpasswd);
  5. mysql_select_db($dbname);
  6.  
  7. $sqlcat
  8. $sqlsub;
  9.  
  10. $result = mysql_query($sqlcat);
  11.  
  12. if (!$result) {
  13.     echo "Could not successfully run query ($sqlcat) from DB: " . mysql_error();
  14.     exit;
  15. }
  16.  
  17. if (mysql_num_rows($result) == 0) {
  18.     echo "No rows found, nothing to print so am exiting";
  19.     exit;
  20. }
  21. while ($row = mysql_fetch_assoc($result)) {
  22.      
  23.     echo "<OPTION>";
  24.     echo $row["category"];
  25.     echo "</OPTION>";
  26.  
  27. }
  28.  
  29.     echo "</select>";
  30.     echo "<br>";
  31.  
  32.  


The tables structure to capture the category, subcategory and catedory_subcategory table as belows:

category:
id
category
description

subcategory
id
subcategory
description

maincat_subcat
category
subcategory


What i want is, when user change the category code on the option selector. It will dynamically retrieve(from DB) subcategory belong to the select category



Thanks

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Dynamic Select Box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway