Value of dropdown not showing after reload [closed]

on my website you can choose your city, province and region. Once you choose the region you can now select the province after province you can now select for city. ONce i save the info and reload the page the data or the one i choose on the dropdown of city and province is not showing

the saved data is showing on the database but the data is not showing in the website once you reload it

  • 2

    You’ll have to include your code here, otherwise we can only guess why your code is not working…

    – 

  • const ContactInfoForm =()=>{ const [regions, setRegions] = useState([]); const [provinces, setProvinces] = useState([]); const [cities, setCities] = useState([]); const [selectedRegion, setSelectedRegion] = useState(”); const [selectedProvince, setSelectedProvince] = useState(”); const location = useLocation(); const { pathname } = location; console.log(pathname); const user_id = pathname.split(“/”)[2]; const [userContact, setUserContact]=useState({})

    – 

  • <select onChange={handleInputChange} value={userContact.prov_id} name=”prov_id” id=”user_prov” className=”block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600 peer” placeholder=” “> <ProvinceDropdown provinces={provinces} selectedRegion={selectedRegion} value={selectedProvince} onChange={handleInputChange} /> </select> the contents of the dropdown is on other jsx file

    – 

  • It looks like there is no code that gets the previous data and puts it in the form fields after a reload. If you create a new question include the code that you expect to load the previous data.

    – 

Leave a Comment