Good evening,
I have a search that is working fine, I'm only now having a problem when someone writes a word with an accent or two words separated by space, I break the url.
Would you like to know how I can resolve this situation?
Code
<form method="post" id="form" action="">
<div style="margin-left:150px;">
<div style="float:left; width:500px;"><input style="height: 38px;" id="valor_pesquisa" name="valor_pesquisa" type="text" placeholder="Restaurantes, bares, hotéis..." /></div>
<div style="float:left; margin-left:5px;"><input type="submit" value="Pesquisar" /></div>
</div>
</form>
<script>
$(function() {
$("#form").submit(function(e) {
if($('#valor_pesquisa').val() === ''){
$("#form").attr("action", "http://sabeonde.pt/locais/pesquisa/todos");
}else{
var valor_pesquisa = $("#valor_pesquisa").val();
$("#form").attr("action", "http://sabeonde.pt/locais/pesquisa/"+valor_pesquisa);
}
});
});
</script>
.htaccess
# Rota Pesquisa
RewriteRule ^locais/pesquisa/([a-zA-Z-0-9-_]+)$ index.php?controller=pesquisa&option=pesquisa&pesquisa=$1
Current
RewriteRule ^locais/pesquisa/([\p{L}\p{N}\s_-]+)$ index.php?controller=pesquisa&option=pesquisa&pesquisa=$1