document.addEventListener('DOMContentLoaded', function() { const searchForm = document.getElementById('locationSearchForm'); if (searchForm) { searchForm.addEventListener('submit', function(event) { event.preventDefault(); const locationInput = document.getElementById('locationInput'); const location = locationInput.value.trim(); if (location) { window.location.href = `listings.php?location=${encodeURIComponent(location)}`; } }); } });