Ok I got some futher.
I did program this together:
$datahost = "xxxxx";
$datauser = "xxxxxx";
$datapasswd = "xxxxxx";
$log_host = "xxxxxxx"; #host name
$log_username = "xxxxxx"; #username
$log_password = "xxxxxxx"; #password
$log_db="xxxxxx"; #database name
function dbconnect($host,$uname,$passwd,$mydb)
{
$db = mysql_connect('xxxxxxx','xxxxx','xxxxxx');
$fields = mysql_list_fields("xxxxxx", "xxxxxx", $db);
$columns = mysql_num_fields($fields);
$query="select id,naam from xxxxxx";
$result = MYSQL_QUERY($query) or die(mysql_error());
$data=mysql_fetch_array($result);
echo "\nHoofdcategorie kiezen: <select name=\"sel_db\" onChange=\"JavaScript:form.submit/B;\">\n";
echo "<option value=\"\" selected>selecteer hoofdgroep ....</option>\n";
while ($data=mysql_fetch_array($result)) {
if ($result)
{
$naam = $data[naam];
$id = $data[id];
echo "<option value=$id>$naam</option>\n";
} else {
echo "<option value=$id>$naam</option>\n";
}
}
echo "</select>";
echo "<br>";
}
function ddtables ($sel_db){
$db = mysql_connect('xxxxxx','xxxxxxx','xxxxxxxxx');
mysql_select_db("xxxxxxx");
$fields = mysql_list_fields("xxxxx", "xxxxxx", $db);
$columns = mysql_num_fields($fields);
$query="select id,naam from submenu where hoofd='$sel_db'";
$result = MYSQL_QUERY($query) or die(mysql_error());
$data=mysql_fetch_array($result);
echo "\nSubcategorie kiezen <select name=\"sub\" .onChange=\"JavaScript:form.submit();\"> \n";
echo "<option value=\"\">selecteer subcatergorie ....</option>\n";
while ($data=mysql_fetch_array($result))
{
if (!empty($result))
{
$naam = $data[naam];
$id = $data[id];
echo "<option value=$id>$naam</option>\n";
} else {
echo "<option value=$id>$naam</option>\n";
}
}
echo "</select>";
echo "<br>";
}
echo "<form>";
dbconnect("$datahost","$datauser","$datapasswd","$sel_db");
ddtables ("$sel_db");
echo "</form>";
This does that I got two select boxes and the last one data is depenend on the first select box.
But I want only to reload the page and not submit! I want to submit my form with a submit button and not with the second selectbox. But I want to refresh the select boxes if I want to.
I hope you can help me futher with this.
I have to say I never have worked with javascript. This is my first time.
Thanks,
Chim