Jump to content

DROP DOWN MENU PROLEM


ritwik

Recommended Posts

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.