Well, it is very easy to load up a clause with values. Here is an example of how to do it.
It is just loosely written to show you an example. You will also need to make the drop-down (SELECT) cause
a submit of the form. I will show you how to do that too. (It is the Javascript inside the drop-down that does
this for you. Hope this helps…
[php]
<?php
$dbconn = mysqli_connect('hostname', 'username', 'password', 'database-name');
$sql = "SELECT * FROM tablename";
$result = mysqli_query($dbconn, $sql);
echo "";
echo "Select something here...";
while ($row = mysqli_fetch_array($dbconn, $result)) {
echo "" . $row['field_date'] . "";
}
echo "";
?>
[/php]
Notes: See in the clause that I added the on-change option so that it posts the form. This would be
used the first drop-down that you want to use the changed value to reload the second one with. The second
one would not need this as you would want the user to press the submit button instead. And, as you see, you
will need to load the correct field names, table names, etc where needed. Like the filed name for your dates.
You would need to do the above for each drop down that you want to make others to be altered. Let’s say
name the first like this: , you would need to load the value of it
and test if they had selected one. To do that, you use a line that reads the value of the drop-down and then
use it in the second drop down to read data from the database based on it. Loosely like this one:
$first_drop_down=$_POST[“first_drop_down”];
If the value is empty, then the user did not select a value and your code should handle it as needed. If they
selected a value, then you would load the second drop-down based on that value using the “WHERE” clause in
the query.
Well, that should help you get started… As a newbie, you might want to read up on all of these functions. You
can review just about any command you might need in the PHP.net site, or even better use the link below.
You can select the language you want to read about at the top, such as HTML, CSS, PHP and then select a
subject under each on the left such as database, functions, etc… Hope this helps…
http://www.w3schools.com/php/php_intro.asp
(Just press the green Next-Chapter button when you are in a tutorial…)
And, when you get stuck, ask us and someone here will help you. Remember to place your code inside the
PHP tags which helps us a lot…