Jump to content

$_Get Always Returns Blank


RockyMtnHi

Recommended Posts

When you do a search at (right sidebar):

http://ourneighborhooddirectory.org

the $_GET result is always blank. The site is hosted at Bluehost and this is a Wordpress site. You can see the result of the query because I write them out. Here is the form code:

<form method="get" action="http://ourneighborhooddirectory.org/search-results/" >
Search the Directory:
<input type="text" name="srch"/>
<input type="submit" value="Search" />
</form>

 

Here is the PHP code on the action page:

<?php
$srchVal = $_GET["srch"];
echo $_GET['srch'];
echo "------------ ". $srchVal." ------------";
print_r($_GET);
echo $_SERVER['QUERY_STRING'];
?>

 

Any ideas on why $_POST and $_GET always return blank?

 

Thanks for the help...

Link to comment
Share on other sites

I added it but it didn't work (I had it in there before but removed it in testing). The code is now:

<form method="get" action="http://ourneighborhooddirectory.org/search-results/" >
Search the Directory:
<input type="text" value="" name="srch"/>
<input type="submit" value="Search" />
</form>

Link to comment
Share on other sites

I did have some .htaccess rules for redirects. I removed them and tested again and the Wordpress page still doesn't fetch the $_Get variables.

 

Here is the code inside of Wordpress:

http://ourneighborhooddirectory.org/search-results/?srch=window

Here is the same code that works outside of Wordpress:

http://ourneighborhooddirectory.org/3.php/?srch=window

 

Somehow Wordpress is filtering out the $_GET values.

 

 

Link to comment
Share on other sites

Fixed it!

 

The Wordpress Inline PHP plugin was at the center of it. I just used an include between the <exec></exec> tags and that stripped out the $_GET['var'] values. When I placed the actual code in the file that was included the values were passed through.

 

The application is a custom database application that is a directory of businesses servicing high-end neighborhoods in the Denver area. The search capability needed to pull specific listings that were searched for so I had to create the custom search capability for the site. I also went the extra step of highlighting all of the search terms.

 

Here is the category page:

http://ourneighborhooddirectory.org/homeowner-recommended-neighborhood-service-guide/neighborhood-service-guide-categories/

Here is every listing:

http://ourneighborhooddirectory.org/homeowner-recommended-neighborhood-service-guide/recommended-service-guide-listings/

 

Do a search using the right sidebar search box. Search for something like 80210, floor, carpet, window, or jack. All 3 of these pages are custom PHP embedded into our Wordpress site.

 

Thanks for the help...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.