Welcome Guest, Not a member yet? Register   Sign In
Redirecting to SEO-friendly URL using form
#1

[eluser]nyalex[/eluser]
I am building a local search directory. One that will allow users to search for a keyword (ex: dentist) and a location (ex: New York, NY) using two form fields.

It consists of two pages:

Page 1: The search form with only two text boxes (keyword & location) for searching.

Page 2: The results page that is a list of the relevant search results.

The problem is that the search results page doesn't list the search keywords within the landing URL. The query uses $this->input->post instead of $this->uri->segment(n).

Is there anyway to force the form on page 1 to redirect to the search results page with url_title(keyword) and url_title(location) in the URL with the current query logic?

Thanks again in advance.
#2

[eluser]nyalex[/eluser]
Is this possible?
#3

[eluser]danmontgomery[/eluser]
Code:
$keyword = url_title($this->input->post('keyword'));
$location = url_title($this->input->post('location'));
redirect('some/page/' . $location . '/' . $keyword);
#4

[eluser]angeal99[/eluser]
@noctrun

thanks for your code dude Smile




Theme © iAndrew 2016 - Forum software by © MyBB