Re: [PHP] dependable combo boxes with mysql database (Solved)
I have got it done. Below is the code: - form name=from_service method=post FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBService/B/FONT /DIV select name=D1 size=1 style=position:absolute;left:230px;top:68px;z-index:7 onChange=form_service.submit(); ?php display_db_combo(service_master,service_name,$conn); $ser=$_POST['D1']; if ($ser == ){ print(option selectedSelect Service/option); } else { print(option selected$ser/option); } ? /select DIV style=position:absolute; left:65px; top:106px; width:83px; height:22px; z-index:4 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBProduct/B/FONT /DIV select name=D2 size=1 style=position:absolute;left:230px;top:108px;z-index:8 onChange=form_service.submit(); ?php display_db_combo1(service_master,service_id,service_name,product_master,product_name,$conn); $ser=$_POST['D1']; $prd=$_POST['D2']; $a='Select Product'; if ($prd == ){ print(option selected$a/option); } else { print(option selected$prd/option); } ? /select DIV style=position:absolute; left:65px; top:152px; width:103px; height:44px; z-index:5 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBNature of Problem/B/FONT /DIV select name=D3 style=position:absolute;left:230px;top:170px;z-index:9 size=1 onChange=form_service.submit(); ?php display_db_combo2(product_master,product_id,product_name,problem_products,problem,$conn); $prb=$_POST['D3']; $prd=$_POST['D2']; if ($prb == || $prd == Select Product) { print(option selectedSelect Problem/option); } else{ print(option selected$prb/option); } ? /select /form - regards, Bhoomi --- Pranav Negandhi (concept-I) [EMAIL PROTECTED] wrote: This might be slightly OT on this list, but here goes nothing. 1. Submit the form when the user shifts focus from D1 using Javascript's onBlur event 2. On the server side, use PHP to retrieve the values for D2 and generate the page again 3. Repeat 1 2 when the value of D2 changes. HTH Pranav www.concept-i.co.in Bhoomi Vora wrote: Hello All, I have a php page which contains three combo boxes. The first one will have the value from the mysql database table on page load itself. Then depending upon the value selected in the first combobox the second combo box should be populated with the respective values from another mysql database table, and once again depending upon the value selected in second combobox the third combobox should be populated with the respective values from one more different database table. I have read through mailing list and also searched in google and found that it can be done with javascript onblur function but nothing is working. Here is the code: .d similarly D3 should be populated on event like 'onblur' to D2. Pl. give me the exact code or proper guideline how should I accomplish this on the same page. Appreciate your replies. Thanks and regards. BJV __ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] dependable combo boxes with mysql database
On Fri, November 4, 2005 11:24 am, Bhoomi Vora wrote: I have a php page which contains three combo boxes. The first one will have the value from the mysql database table on page load itself. Then depending upon the value selected in the first combobox the second combo box should be populated with the respective values from another mysql database table, and once again depending upon the value selected in second combobox the third combobox should be populated with the respective values from one more different database table. I have read through mailing list and also searched in google and found that it can be done with javascript onblur function but nothing is working. Here is the code: -- ?php include_once(inc\connection.inc); //with this function first combobox will be populated on pageload function display_db_combo($tablename,$columnname,$connection) { $query_string=select $columnname from $tablename; $result=mysql_query($query_string); while($row=mysql_fetch_array($result)) { print(option$row[0]/option); } } ? Do this again, only put the data for D2 and D3 in JavaScript arrays: ?php function dump_js_array($tablename,$columname,$connection) { . . . print(script language=\javascript\\n; print(\tvar D2 = array(''\n); //this is printing out JavaScript code while($row...) { print(\t\t,'$row[0]'\n); //elements of array (note '' above) } print(\t);\n); //end of JavaScript array print(/script\n); } ? Then you can use the onblur() in JavaScript to pull data out of those JavaScript arrays to populate D2 and D3. You'll have to work out the JavaScript part somewhere else, as it's JavaScript and not PHP, and I'd probably get it wrong. HTML HEAD TITLEUntitled Page/TITLE META NAME=Generator CONTENT=Created by BlueVoda /HEAD BODY bgcolor=#FF text=#00 DIV style=position:absolute; left:175px; top:70px; width:592px; height:483px; z-index:24 align=left valign=top FORM name=form_cust method=POST action=thisform.php enctype=multipart/form-data DIV style=position:absolute; left:198px; top:65px; width:6px; height:15px; z-index:0 align=left valign=top FONT style=FONT-SIZE:9pt color=#8B face=ArialB:/B/FONT /DIV DIV style=position:absolute; left:198px; top:108px; width:6px; height:15px; z-index:1 align=left valign=top FONT style=FONT-SIZE:9pt color=#8B face=ArialB:/B/FONT /DIV DIV style=position:absolute; left:198px; top:167px; width:6px; height:15px; z-index:2 align=left valign=top FONT style=FONT-SIZE:9pt color=#8B face=ArialB:/B/FONT /DIV DIV style=position:absolute; left:65px; top:60px; width:97px; height:22px; z-index:3 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBService/B/FONT /DIV select name=D1 size=1 style=position:absolute;left:230px;top:68px;z-index:7 ?php display_db_combo(service_master,service_name,$conn);? /select DIV style=position:absolute; left:65px; top:106px; width:83px; height:22px; z-index:4 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBProduct/B/FONT /DIV select name=D2 size=1 style=position:absolute;left:230px;top:108px;z-index:8 /select DIV style=position:absolute; left:65px; top:152px; width:103px; height:44px; z-index:5 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBNature of Problem/B/FONT /DIV select name=D3 style=position:absolute;left:230px;top:170px;z-index:9 size=1 value= /select DIV style=position:absolute; left:177px; top:1px; width:270px; height:22px; z-index:9 align=center valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBUComplaint Registration/B/U/FONT /DIV INPUT type=reset name=Edit_Reset value=Reset style=position:absolute;left:376px;top:429px;z-index:10 INPUT type=submit name=comp_send value=Send style=position:absolute;left:148px;top:429px;z-index:11 INPUT type=text style=position:absolute;left:230px;top:240px;width:161px;z-index:12 size=23 name=T3 value= DIV style=position:absolute; left:257px; top:330px; width:60px; height:18px; z-index:13 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBUpper/B/FONT /DIV DIV style=position:absolute; left:257px; top:359px; width:72px; height:18px; z-index:14 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBMiddle/B/FONT /DIV DIV style=position:absolute; left:257px; top:386px; width:60px; height:18px; z-index:15 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBLower/B/FONT /DIV DIV style=position:absolute; left:65px; top:240px; width:123px; height:66px; z-index:16 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBProblem Description/B/FONT /DIV DIV style=position:absolute; left:198px; top:240px;
Re: [PHP] dependable combo boxes with mysql database
It's simply a matter of echoing HTML/ JS statements in PHP. The easiest way to integrate JS into a PHP page is like this - ?php // PHP CODE HERE print(script src=functions.js/) // CONTINUE PHP CODE HERE ? All your JS code is to be put into the functions.js file. Watch for the correct relative path. You could also use this method - ?php // PHP CODE HERE ? script src=functions.js/ ?php // CONTINUE PHP CODE ? This is all email-code. There may be some syntax errors, which you'll have to fix at your end. But the gist remains the same. I'd suggest you also spend some time reading the HTML output from your PHP code. It's the best way to learn. Regards, Pranav www.concept-i.co.in Bhoomi Vora wrote: Hello, Thanks for the reply. But I do not know how to integrate javascript with php and mysql. I mean javascript can be written using script language=javascriptcode/script and fetching data from mysql is using $query,$result and $mysql_fetch_array. I am confused how to integrate this in php page. If anybody can help on this i will highly appreciate it, otherwise if this is not the proper question for this list then i have to go for other options. Thanks and regards, Bhoomi --- Pranav Negandhi (concept-I) [EMAIL PROTECTED] wrote: This might be slightly OT on this list, but here goes nothing. 1. Submit the form when the user shifts focus from D1 using Javascript's onBlur event 2. On the server side, use PHP to retrieve the values for D2 and generate the page again 3. Repeat 1 2 when the value of D2 changes. HTH Pranav www.concept-i.co.in Bhoomi Vora wrote: Hello All, I have a php page which contains three combo boxes. The first one will have the value from the mysql database table on page load itself. Then depending upon the value selected in the first combobox the second combo box should be populated with the respective values from another mysql database table, and once again depending upon the value selected in second combobox the third combobox should be populated with the respective values from one more different database table. I have read through mailing list and also searched in google and found that it can be done with javascript onblur function but nothing is working. Here is the code: .d similarly D3 should be populated on event like 'onblur' to D2. Pl. give me the exact code or proper guideline how should I accomplish this on the same page. Appreciate your replies. Thanks and regards. BJV __ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [php] dependable combo boxes with mysql database
Hello All, I have a php page which contains three combo boxes. The first one will have the value from the mysql database table on page load itself. Then depending upon the value selected in the first combobox the second combo box should be populated with the respective values from another mysql database table, and once again depending upon the value selected in second combobox the third combobox should be populated with the respective values from one more different database table. I have read through mailing list and also searched in google and found that it can be done with javascript onblur function but nothing is working. Here is the code: -- ?php include_once(inc\connection.inc); //with this function first combobox will be populated on pageload function display_db_combo($tablename,$columnname,$connection) { $query_string=select $columnname from $tablename; $result=mysql_query($query_string); while($row=mysql_fetch_array($result)) { print(option$row[0]/option); } } ? HTML HEAD TITLEUntitled Page/TITLE META NAME=Generator CONTENT=Created by BlueVoda /HEAD BODY bgcolor=#FF text=#00 DIV style=position:absolute; left:175px; top:70px; width:592px; height:483px; z-index:24 align=left valign=top FORM name=form_cust method=POST action=thisform.php enctype=multipart/form-data DIV style=position:absolute; left:198px; top:65px; width:6px; height:15px; z-index:0 align=left valign=top FONT style=FONT-SIZE:9pt color=#8B face=ArialB:/B/FONT /DIV DIV style=position:absolute; left:198px; top:108px; width:6px; height:15px; z-index:1 align=left valign=top FONT style=FONT-SIZE:9pt color=#8B face=ArialB:/B/FONT /DIV DIV style=position:absolute; left:198px; top:167px; width:6px; height:15px; z-index:2 align=left valign=top FONT style=FONT-SIZE:9pt color=#8B face=ArialB:/B/FONT /DIV DIV style=position:absolute; left:65px; top:60px; width:97px; height:22px; z-index:3 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBService/B/FONT /DIV select name=D1 size=1 style=position:absolute;left:230px;top:68px;z-index:7 ?php display_db_combo(service_master,service_name,$conn);? /select DIV style=position:absolute; left:65px; top:106px; width:83px; height:22px; z-index:4 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBProduct/B/FONT /DIV select name=D2 size=1 style=position:absolute;left:230px;top:108px;z-index:8 /select DIV style=position:absolute; left:65px; top:152px; width:103px; height:44px; z-index:5 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBNature of Problem/B/FONT /DIV select name=D3 style=position:absolute;left:230px;top:170px;z-index:9 size=1 value= /select DIV style=position:absolute; left:177px; top:1px; width:270px; height:22px; z-index:9 align=center valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBUComplaint Registration/B/U/FONT /DIV INPUT type=reset name=Edit_Reset value=Reset style=position:absolute;left:376px;top:429px;z-index:10 INPUT type=submit name=comp_send value=Send style=position:absolute;left:148px;top:429px;z-index:11 INPUT type=text style=position:absolute;left:230px;top:240px;width:161px;z-index:12 size=23 name=T3 value= DIV style=position:absolute; left:257px; top:330px; width:60px; height:18px; z-index:13 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBUpper/B/FONT /DIV DIV style=position:absolute; left:257px; top:359px; width:72px; height:18px; z-index:14 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBMiddle/B/FONT /DIV DIV style=position:absolute; left:257px; top:386px; width:60px; height:18px; z-index:15 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBLower/B/FONT /DIV DIV style=position:absolute; left:65px; top:240px; width:123px; height:66px; z-index:16 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBProblem Description/B/FONT /DIV DIV style=position:absolute; left:198px; top:240px; width:6px; height:15px; z-index:17 align=left valign=top FONT style=FONT-SIZE:9pt color=#8B face=ArialB:/B/FONT /DIV DIV style=position:absolute; left:65px; top:310px; width:123px; height:44px; z-index:18 align=left valign=top FONT style=FONT-SIZE:12pt color=#8B face=Courier NewBSeverity of Problem/B/FONT /DIV DIV style=position:absolute; left:198px; top:329px; width:6px; height:15px; z-index:19 align=left valign=top FONT style=FONT-SIZE:9pt color=#8B face=ArialB:/B/FONT /DIV INPUT type=radio name= value= style=position:absolute;left:221px;top:330px;z-index:20 INPUT type=radio name= value= style=position:absolute;left:221px;top:357px;z-index:21 INPUT type=radio name= value=
RE: [PHP] [php] dependable combo boxes with mysql database
[snip] In the above code there are three combo box namely D1, D2 and D3. D1 will be populated on pageload. Now D2 should be populated on event like 'onblur' to D1 and similarly D3 should be populated on event like 'onblur' to D2. Pl. give me the exact code or proper guideline how should I accomplish this on the same page. [/snip] Unfortunately this is a PHP list and your question concerns JavaScript. I found this while googling onblur executes JavaScript whenever a user moves with the mouse the focus away from an element within a form. In other words, whenever a person first clicks an element, and then clicks anywhere outside of it. Here is a tutorial http://www.javascriptkit.com/javatutors/form6.shtml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] dependable combo boxes with mysql database
This might be slightly OT on this list, but here goes nothing. 1. Submit the form when the user shifts focus from D1 using Javascript's onBlur event 2. On the server side, use PHP to retrieve the values for D2 and generate the page again 3. Repeat 1 2 when the value of D2 changes. HTH Pranav www.concept-i.co.in Bhoomi Vora wrote: Hello All, I have a php page which contains three combo boxes. The first one will have the value from the mysql database table on page load itself. Then depending upon the value selected in the first combobox the second combo box should be populated with the respective values from another mysql database table, and once again depending upon the value selected in second combobox the third combobox should be populated with the respective values from one more different database table. I have read through mailing list and also searched in google and found that it can be done with javascript onblur function but nothing is working. Here is the code: .d similarly D3 should be populated on event like 'onblur' to D2. Pl. give me the exact code or proper guideline how should I accomplish this on the same page. Appreciate your replies. Thanks and regards. BJV __ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dependable combo boxes with mysql database
Hello, Thanks for the reply. But I do not know how to integrate javascript with php and mysql. I mean javascript can be written using script language=javascriptcode/script and fetching data from mysql is using $query,$result and $mysql_fetch_array. I am confused how to integrate this in php page. If anybody can help on this i will highly appreciate it, otherwise if this is not the proper question for this list then i have to go for other options. Thanks and regards, Bhoomi --- Pranav Negandhi (concept-I) [EMAIL PROTECTED] wrote: This might be slightly OT on this list, but here goes nothing. 1. Submit the form when the user shifts focus from D1 using Javascript's onBlur event 2. On the server side, use PHP to retrieve the values for D2 and generate the page again 3. Repeat 1 2 when the value of D2 changes. HTH Pranav www.concept-i.co.in Bhoomi Vora wrote: Hello All, I have a php page which contains three combo boxes. The first one will have the value from the mysql database table on page load itself. Then depending upon the value selected in the first combobox the second combo box should be populated with the respective values from another mysql database table, and once again depending upon the value selected in second combobox the third combobox should be populated with the respective values from one more different database table. I have read through mailing list and also searched in google and found that it can be done with javascript onblur function but nothing is working. Here is the code: .d similarly D3 should be populated on event like 'onblur' to D2. Pl. give me the exact code or proper guideline how should I accomplish this on the same page. Appreciate your replies. Thanks and regards. BJV __ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php