HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

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 Dev Shed Forums Sponsor:
  #1  
Old June 15th, 2000, 11:54 AM
walshs walshs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 112 walshs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Hi

I am building a web page which has two drop down menus one for country and one for region, The region box is filled with regions corresponding to the country currently selected in the country drop down.

I am using PHP and MYSQL to dynamically generate the regions and countries. So on the intial load the counrty selected is England and has value of 1 in the database , thus it generates the regions which have counrty value 1.

i need a script which can detect a change in the counrty drop down , pass the value of the drop down and reload the page using this value , for if Scotland was selected the page would reload with country value = 2 etc.

i think i need a piece of javascript , can anyone help?

Thanks in advance

Waseem

Reply With Quote
  #2  
Old June 15th, 2000, 04:17 PM
Spookster Spookster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 1999
Posts: 84 Spookster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
You mean something like this?
http://www.wsabstract.com/script/cut183.shtml

Spookster

------------------
Visit the WSAbstract Help Forum for your Javascript, DHTML, or General Web Design Questions

Reply With Quote
  #3  
Old June 16th, 2000, 06:20 AM
walshs walshs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 112 walshs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Thanks for the reply i got it to work by using the onChange function


Reply With Quote
  #4  
Old August 30th, 2000, 02:05 PM
robinsn robinsn is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 12 robinsn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
walshs,

I've been trying to accomplish the exact same thing (except not country/regions) with php and mysql.

I used the onchange, which works great, and refreshed the page, but it doesn't work in netscape. It also was a pain to get the code working which kept the correct value in the first dropdown and recognized whether you were coming into the page for the first time or whether you had changed the first dropdown and were now refreshing the second one.

Can you show me the code you used to get it to work?

Here's my code that "almost" works. It started out simple, but with the problems, grew into frankenstein.

function ProcSel(themfg) {
SetCookie("cmfg",themfg.value);
self.location.reload();
}

function SetCookie (name,thevalue) {
document.cookie = name + ' = ' + thevalue + ';';
}

<?PHP
$rslt = mysql_query("SELECT DISTINCT mfg FROM equipment WHERE type='COMPUTER'", $dbConnect);
echo "<SELECT NAME='mfg' onChange='ProcSel(this)' SIZE='1'>n";
if ($cmfg=="")
if(mysql_num_rows($rslt))
$cmfg=mysql_result($rslt,0,"mfg");
while ($row = mysql_fetch_array($rslt)) {
echo "<OPTION VALUE='".$row['mfg']."'";
if ($cmfg == $row['mfg'])
echo " SELECTED>".$row['mfg']."n";
else
echo ">".$row['mfg']."n";
}
echo "</SELECT>n";
?>
Choose Model:</TD>
<?PHP
$rslt = mysql_query("SELECT model,va,modelid FROM equipment WHERE mfg='$cmfg' AND type='COMPUTER'", $dbConnect);
echo "<SELECT NAME='model' SIZE='1'>n";
while ($row = mysql_fetch_array($rslt)) {
echo "<OPTION VALUE='".$row['modelid']."'>".$row['model']." (".$row['va']." VA)n";
}
echo "</SELECT>n";
?>


------------------
-Randy

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Drop Down Menu Refresh


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 4 hosted by Hostway
Stay green...Green IT