ritwik Posted August 9, 2008 Share Posted August 9, 2008 Hi everybody, I am trying to create a drop down menu in my php 5.0 , mysql 5.0 application where I want to fetch values of a second drop down from mysql tables on the values based on the value selected on the first drop down menu. I have so many other textboxes their in the same form and I dont want my page to be refreshed, so that values written in the other fields are lost and user has to enter those values again. Any help regarding is greatly appriciated. thanks and regards Quote Link to comment Share on other sites More sharing options...
Dathremar Posted August 9, 2008 Share Posted August 9, 2008 Well, dunno if i got this right ... but you can prefetch all the info of the tables on page load and put them into a javascript arrays. So when the user select something from 1 drop down menu, with a javascript event look for the resaults in the array which u already have declared on the page load. If u think that this is something u can use tell me i will post more. cheer Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted August 9, 2008 Share Posted August 9, 2008 I have so many other textboxes their in the same form and I dont want my page to be refreshed, so that values written in the other fields are lost and user has to enter those values again. you can let them submit the first form. put the values into a session variable. Then they can enter the values in both text boxes separate, but you will still get the data from both to work with. Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted August 9, 2008 Share Posted August 9, 2008 I did something llike this yesterday. I used to forms. Form 1 to get how many fields are in the second. Form 2 what ever you want form1 <form> <input type="text" name="moves" id="moves"> <input onClick="step2.php" type="submit" name="step" id="step" value="Next Step"> </form> Form 2 $moves=$_POST['moves']; for ($i=1; $i<=$moves; $i++) { echo'<tr><td width="50%"><span id="sprytextfield1"><label> '.$i.') <input name="white_move_'.$i.'" type="text" id="white_move_'.$i.'" size="9"></label> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Please Enter Whites Move.</span></span></td>'; echo'<td width="50%"><span id="sprytextfield2"> <label><input name="black_move_'.$i.'" type="text" id="black_move_'.$i.'" size="9"> </label> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Please Enter Blacks Move</span></span></td></tr>'; } You have to replace everything but the backbone is there Quote Link to comment Share on other sites More sharing options...
ritwik Posted August 9, 2008 Author Share Posted August 9, 2008 thanks all. ley me try and I will get back to you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.