User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 7 Jul 2003, 20:04   #1
Cicada
p a r r a c i d a
 
Join Date: Apr 2000
Location: #titans
Posts: 511
Cicada is an unknown quantity at this point
javascript..how i hate it...

simple thing really..

i have 2 select thingys, both feeding data from a php script / database thingy...

now they're related, so what happens in the first one, i want to affect what the options are for the second one. Now i want to do this without having to sumbit the form, and i know javascripts the way to do it..

prolly using onchange i guess...but if anyone can help it'd be nice..
__________________
Cicada || No Warning, No Mercy, No Ambiguity || [Titans] [F.E.A.R]
Cicada is offline   Reply With Quote
Unread 8 Jul 2003, 09:33   #2
SbOlly
Spelling is for pussies
 
SbOlly's Avatar
 
Join Date: Mar 2003
Location: Actually, where the feck am I........?
Posts: 446
SbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant future
#javascript ?
__________________
If God made me in his image, he's one fat ugly biatch.

I always get the soggy biscuit

Veni Vidi Codi
SbOlly is offline   Reply With Quote
Unread 8 Jul 2003, 09:47   #3
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
There's a very good thread about this already, maybe a week or two old, in this very forum. But if ppl can't be arsed looking, I'm not arsed to point it out :P

M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"

O2 Rip-off campaign

<vampy> plus i hate people ... i despise humanity as a whole

pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
Mong is offline   Reply With Quote
Unread 8 Jul 2003, 11:56   #4
Cicada
p a r r a c i d a
 
Join Date: Apr 2000
Location: #titans
Posts: 511
Cicada is an unknown quantity at this point
i read it, i just couldn't figure out how to 'convert' that code into 2 selects as opposed to 1 select and a text area..
__________________
Cicada || No Warning, No Mercy, No Ambiguity || [Titans] [F.E.A.R]
Cicada is offline   Reply With Quote
Unread 8 Jul 2003, 12:30   #5
Cicada
p a r r a c i d a
 
Join Date: Apr 2000
Location: #titans
Posts: 511
Cicada is an unknown quantity at this point
heres the code that i worked out to kinda do it..

Code:
$shows=array();
$seasons=array();
	
$count=0;
$query="select * from shows";
$result= mysql_query ($query);
while ($row=mysql_fetch_array($result))	{
	$shows[$count]=$row[name];
	$seasons[$count]=$row[seasons];
	$count++;
}
	
?>

<select name="user">
<option value="0">Choose</option>
<?
for ($i=0;$i<$count;$i++) {
	echo "<option value=".$i.">".$shows[$i]."</option>";
}
?>
</select>

<select name="details">
<?
for ($i=1;$i<=$seasons[$z];$i++) {
	echo "<option>Season ".$i."</option>";
}
?>
</select>
<?
now all i need is some jscript to change the value of $z depending on what the value is changed to in the 'user' select
__________________
Cicada || No Warning, No Mercy, No Ambiguity || [Titans] [F.E.A.R]
Cicada is offline   Reply With Quote
Unread 8 Jul 2003, 13:30   #6
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
Quote:
Originally posted by Cicada
i read it, i just couldn't figure out how to 'convert' that code into 2 selects as opposed to 1 select and a text area..
Ah that's a point sorry. It's also something I don't know either :-(

M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"

O2 Rip-off campaign

<vampy> plus i hate people ... i despise humanity as a whole

pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
Mong is offline   Reply With Quote
Unread 8 Jul 2003, 13:38   #7
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
Step 1. Work out how to alter a set of options in Javascript that works on the browsers you want it to work on.
Step 2. Work out how to embed the information you want in Javascript from PHP so that selecting a option from the first select sets the options in the second select.
Step 3. Provide a decent default from browsers without Javascript. This should be easy if it's just numbers.

Which step gives you trouble?
queball is offline   Reply With Quote
Unread 8 Jul 2003, 14:16   #8
Cicada
p a r r a c i d a
 
Join Date: Apr 2000
Location: #titans
Posts: 511
Cicada is an unknown quantity at this point
Quote:
Originally posted by queball
Step 1. Work out how to alter a set of options in Javascript that works on the browsers you want it to work on.
Step 2. Work out how to embed the information you want in Javascript from PHP so that selecting a option from the first select sets the options in the second select.
Step 3. Provide a decent default from browsers without Javascript. This should be easy if it's just numbers.

Which step gives you trouble?
that would be all of it..

javascript seems to give me like altzehimers or something
__________________
Cicada || No Warning, No Mercy, No Ambiguity || [Titans] [F.E.A.R]
Cicada is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 18:24.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018