Jump to content

Building a query string


coder1

Recommended Posts

I have a form search form that can pass up to 14 parameters (all dropdown list and 2 groups of radio buttons) the user can select combination.

 

1) Whats the best away to build a query string from the form to pass to mysql query

 

as currently what am doing is for each. Am not sure if that is the best way of doing it?

 

if ($_POST["location"]!="")
{
$searchstring=$searchstring.$_POST["location"];

}

if ($_POST["propertytype"]!="") 
{
$searchstring=$searchstring.' and `type` = \''.$_POST["propertytype"].'\'';
}


 

The query can return large resultset so I implemented  a simple paging.

 

2) how do go about using the above $_post method to build a query string to pass to a url.

 

 

thanks in advance.

 

Link to comment
https://forums.phpfreaks.com/topic/125316-building-a-query-string/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.