0

Is it possible to show the last selected value from the drop down list box after form reload?

4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by lakshmi_lux
0

Thanks but actually my problem is that my form remembers the value after form RELOAD.But my drop down list box doesn't show the option that was selected to the user.
I have two three drop down list boxes where the selection of the first list box determines the values present in the second list and the values in the third list box are determine by the option selected in the second list box.
for this i have used

echo "<select name='country' onchange=\"reload(this.form)  \">
 <option value=''>Select country</option>";
while($noticia = mysql_fetch_array($quer)) { 
  if($noticia['countryID=']==$country){
  echo "<option value='$noticia[countryID]'>$noticia[countryName]  </option>"."<BR>";}
  }

so the values in the city list box are populated after the form reloads.
Problem is that after the form reloads the list box shows select country instead of the country selected by the user, although the form remembers the countryID of the country selected by the user.

0

hey did you get any solution for that .. ve been workin on thos for quite a long time.... if you ve got pls help me out !!!

0

Ahh, this is simple. Try this:

if($noticia['countryID=']==$country){
  echo "<option value='$noticia[countryID]' selected='selected'>$noticia[countryName]  </option>" . "<BR>";}
}

The key here is putting

selected='selected'

in the option tag for the country you want selected.

Edited by Lsmjudoka: n/a

0

hey thanks a lot :)hey its kinda workin now......but if i m relading the page twice... the value selected in the first drop down list returns back to default value.... actually the page is totally reloaded thrice...i want the things to be maintained even after the first and the second reload ...wat do i do?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.