drop down pblm in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajaymohank
    New Member
    • Jan 2008
    • 29

    drop down pblm in php

    Hello friends........ ..

    i have 3 dropdown in my project, in which 3 of them are linked with each other. ie.... i select a value from the 1st drop down and based on that value, the corresponding values will be displayed in the 2nd drop down and based on the value selected from the 2nd dropdown the corresponding value will be displayed in the 3rd dropdown. the problem is that in my page ,there are textboxes for entering name,date,phno etc........ when i select a value from the dropdown all the other values get blank....ie..in my page first there are textboxes for entering name,phno etcand after that there is the dropdown and when i select a value from dropdown, all the values in the textboxes get blank. so that i have first select the values in the drop down and then enter name, phno etc... in the code for drop down, i have used the code

    document.form1. submit();

    ie... every time i select a value from dropdown, i am submitting the form and because of this page submission my textboxes in the page gets blank...
    if i am not using the page submission, then it wont work.

    is there any way to solve this problem.

    thanks...
  • rpnew
    New Member
    • Aug 2007
    • 189

    #2
    Originally posted by ajaymohank
    Hello friends........ ..

    i have 3 dropdown in my project, in which 3 of them are linked with each other. ie.... i select a value from the 1st drop down and based on that value, the corresponding values will be displayed in the 2nd drop down and based on the value selected from the 2nd dropdown the corresponding value will be displayed in the 3rd dropdown. the problem is that in my page ,there are textboxes for entering name,date,phno etc........ when i select a value from the dropdown all the other values get blank....ie..in my page first there are textboxes for entering name,phno etcand after that there is the dropdown and when i select a value from dropdown, all the values in the textboxes get blank. so that i have first select the values in the drop down and then enter name, phno etc... in the code for drop down, i have used the code

    document.form1. submit();

    ie... every time i select a value from dropdown, i am submitting the form and because of this page submission my textboxes in the page gets blank...
    if i am not using the page submission, then it wont work.

    is there any way to solve this problem.

    thanks...
    Hi,
    If you want to use the same logic then what you need to do is everytime you submit a page through the dropdown you need to keep track of the values of textboxes and load them again when page is reloaded.
    And if you do not want to do that then another thing is use AJAX. You can start searching for Ajax on net and will get many tutorials its easy to learn and use as well and you wont need much of time to learn it and use it..

    Regards,
    RP

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      It depends on where you populate your 2nd and 3rd boxes from. When it is done using only JavaScript box values from a JS array or something, you can fill each subsequent drop down box after the user has selected an option in the box, using a JS event, so without submitting the form.

      When the dd box is filled using server code and/or database, you use the same technique (JS trigger after user has selected), only now you go to the server and fill the drop down from the server reply via JS. The latter solution is Ajax based.

      In both cases you do not need to submit the form for the boxes to be filled.

      Ronald

      Comment

      Working...