Reputation: 2888
I have a website (www.website.com
) and on the homepage is a form, where the user set up a city. After sending the form, I am trying to have the following URL address:
www.website.com/city-name
But I am lost a bit here, because I am not sure, how to set up the form (GET or POST is better for this need?), and .htaccess
.
Could anyone help with this? Thank you
Upvotes: 0
Views: 147
Reputation: 353
You could let the submit button run a javascript function. In that javascript function, use
var cityName = document.getElementById("the textarea id").value
to get the value the user typed for the city name. Then redirect to the right page:
window.location='http://www.website.com/' + cityName
Upvotes: 0