M.W.S.
08-03-2008, 02:16 PM
I think I'm going to become mad soon.
I am building a search form ($_GET) with mod_rewrite for SEO friendly urls.
And because there are forms, I'm using header(location:...) to redirect
this page:
http://localhost/index.php?category=$category&make=$model&go=go
to this:
http://localhost/$category_$model.hw
I'm using this code as well:
if($_REQUEST['category'])
{
$model = $_REQUEST['make'];
$category = $_REQUEST['category'];
$category = clean($category);
search($category, $model);
}
And Here's the search function:
function search($a, $b){
header("Location: http://localhost/$a" . "_$b.hw" );
$qm = "SELECT * FROM car WHERE make = '$a' AND model = '$b'";
$qm = mysql_query($qm) or die(mysql_error());
if (mysql_num_rows($qm) == "0"){
echo "Not found";
}
else
{
while ($rm = mysql_fetch_array($qm)){
extract($rm);
echo "Found!";
}
}
}
And the problem:
When I pass a variable using $_GET or $_REQUEST, I get this page:
Redirect Loop
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.
* Have you disabled or blocked cookies required by this site?
* NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.
What to do? I've been trying to fix this for 2 days... :confused:
I am building a search form ($_GET) with mod_rewrite for SEO friendly urls.
And because there are forms, I'm using header(location:...) to redirect
this page:
http://localhost/index.php?category=$category&make=$model&go=go
to this:
http://localhost/$category_$model.hw
I'm using this code as well:
if($_REQUEST['category'])
{
$model = $_REQUEST['make'];
$category = $_REQUEST['category'];
$category = clean($category);
search($category, $model);
}
And Here's the search function:
function search($a, $b){
header("Location: http://localhost/$a" . "_$b.hw" );
$qm = "SELECT * FROM car WHERE make = '$a' AND model = '$b'";
$qm = mysql_query($qm) or die(mysql_error());
if (mysql_num_rows($qm) == "0"){
echo "Not found";
}
else
{
while ($rm = mysql_fetch_array($qm)){
extract($rm);
echo "Found!";
}
}
}
And the problem:
When I pass a variable using $_GET or $_REQUEST, I get this page:
Redirect Loop
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.
* Have you disabled or blocked cookies required by this site?
* NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.
What to do? I've been trying to fix this for 2 days... :confused: