$cx = ODBC_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
if (!cx) {
Error_handler("Error in odbc_connect", $cx);
}
//FIRST SQL
$strSQL = " SELECT tblOff.off, tblOff.off_name FROM tblOff ";
$cur= odbc_exec($cx, $strSQL);
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cx );
}
print ("<P>OFFICE: ");
print (" <select name=\"officedropdown\" onChange=\"" ."CheckValue(this.value)\" >" );
print ("<option>"."Select an office "."</option>"."\n");
while (odbc_fetch_row ( $cur) ) {
$office = odbc_result($cur,1 );
$off_name =odbc_result($cur,2 );
print ("<option value=http://www.phpbuilder.com/board/archive/index.php/\"$office\"> ".$office." - ".$off_name."</option>"." \n " );
}
print ("</select>");
//SECOND SQL
$strSQL = " SELECT tblClt.clt, tblClt.clt_name FROM tblClt WHERE ".
" tblClt.off='AA' ";
print ("<P>CLIENT OFFICE: ");
print ("<select name=\"clientdropdown\">");
print ("<option>"."Select a client "."</option>"."\n");
while (odbc_fetch_row ( $cur) ) {
$client = odbc_result($cur,1 );
$client_name =odbc_result($cur,2 );
print ("<option value=http://www.phpbuilder.com/board/archive/index.php/\"$client\"> ".$client." - ".$client_name."</option>"."\n");
}
print ("</select>");
how do i store the value i selected on the first drop down and passed it to the second drop down SQL, i.e. instead of hardcoding tblClt.off='AA"; and then pass to the 3rd SQL....all in the same html page.
any good PHP book you can recommend? i have some programming knowledge here and there but no real life experience, not yet.
some sample codes would be good. i searched the forum there are some threads related to dynamic dropdowns.....it may not be a good approach but my boss makes me do it.
thanks.
if (!cx) {
Error_handler("Error in odbc_connect", $cx);
}
//FIRST SQL
$strSQL = " SELECT tblOff.off, tblOff.off_name FROM tblOff ";
$cur= odbc_exec($cx, $strSQL);
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cx );
}
print ("<P>OFFICE: ");
print (" <select name=\"officedropdown\" onChange=\"" ."CheckValue(this.value)\" >" );
print ("<option>"."Select an office "."</option>"."\n");
while (odbc_fetch_row ( $cur) ) {
$office = odbc_result($cur,1 );
$off_name =odbc_result($cur,2 );
print ("<option value=http://www.phpbuilder.com/board/archive/index.php/\"$office\"> ".$office." - ".$off_name."</option>"." \n " );
}
print ("</select>");
//SECOND SQL
$strSQL = " SELECT tblClt.clt, tblClt.clt_name FROM tblClt WHERE ".
" tblClt.off='AA' ";
print ("<P>CLIENT OFFICE: ");
print ("<select name=\"clientdropdown\">");
print ("<option>"."Select a client "."</option>"."\n");
while (odbc_fetch_row ( $cur) ) {
$client = odbc_result($cur,1 );
$client_name =odbc_result($cur,2 );
print ("<option value=http://www.phpbuilder.com/board/archive/index.php/\"$client\"> ".$client." - ".$client_name."</option>"."\n");
}
print ("</select>");
how do i store the value i selected on the first drop down and passed it to the second drop down SQL, i.e. instead of hardcoding tblClt.off='AA"; and then pass to the 3rd SQL....all in the same html page.
any good PHP book you can recommend? i have some programming knowledge here and there but no real life experience, not yet.
some sample codes would be good. i searched the forum there are some threads related to dynamic dropdowns.....it may not be a good approach but my boss makes me do it.
thanks.