PDA

View Full Version : drop down 2 echo seletion on drop down 1


webandwe
05-22-2007, 09:00 AM
Hi,

I have a normal php page with a contact form on it and i am not using any databases.

I would like to put up a list/menu drop down so when you select something it echo's something in the second drop down.

Example

Drop menu 1
-----------------------
course 1
course 2



Drop menu 2
-------------------
If course 1 echo course 1 dates.
If course 2 echo course 2 dates


Does anyone have an example for me or what do I need to search for cause I don't quit know what it is called and thus I cannot find anything on Google.

Thanks

Pennimus
05-22-2007, 09:44 AM
PHP can't do this without reloading the page - for that you will need to look into some JavaScript.

But if you're willing to load a new page you could do:


<a href="courses.php?course=1">Course 1</a>
<a href="courses.php?course=2">Course 2</a>



<?php
$course = $_GET["course"];
if ($course == "1") {
// Course 1 dates here
} else if ($course == "2") {
// Course 2 dates here
}
?>

webandwe
05-22-2007, 03:24 PM
Do you know how do do it in Java?

rafiki
05-22-2007, 04:27 PM
Do you know how do do it in Java?

if you wanted it in java why didn't you post in the java forum! and did you mean javascript they are 2 different things

webandwe
05-23-2007, 07:29 AM
Hi, I asked if someone could do it with PHP and you said you need a javascript.

I asked then if you know how to do it in the java you metioned, if no, then i'll go to a javascript forum...

Pennimus
05-23-2007, 09:26 AM
No I don't I'm afraid - lets get this moved over there.