Help with search

Asked

Viewed 29 times

1

I have a simple search field below, which when used returns with a link similar to:meusite.com/search?q=minhabusca. I need him to come back like this:meusite.com/search?q=minhabusca&by-date=true, so that posts are always shown sorted by dates. How can I do?

<form action='/search' method='get'>
 <input autocomplete='off' name='q' placeholder=' O que procura?' size='40' type='text'/>
 <button type='submit'>buscar</button>
</form>

1 answer

1


Add a input hidden in his form. Just add the attribute hidden, this way the input will not appear to the user, but still its value will be sent in the submit form.

<form action='/search' method='get'>
 <input autocomplete='off' name='q' placeholder=' O que procura?' size='40' type='text'/>
 <input name='by-date' value='true' hidden/>
 <button type='submit'>buscar</button>
</form>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.