I have a search query that returns a results page that works great, if it receives data from the form. But if a user goes directly to the results page (they bookmarked the page) I want them to see all the results. The search is by day of the week and area . Can I default the day to the current day date("l") and the Area variable to Entire City? Code is below:
require("dbinfo.php");
$Area=$_POST['Area'];
$Day=$_POST['Day'];
$ID=$_POST['ID'];
include("History.php");
$con = mysql_connect('localhost', $username, $password );
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db($database, $con);
if (!$db_selected) {
die ('Can\'t use DB : ' . mysql_error());
}
$sql = "SELECT
`ID`,`Name`,`Address`,`".$Day."`,`Area`,`PhoneNumber`,`logo`,`Website` FROM
`JaxPlaces` WHERE (Area = '".$Area."' OR '".$Area."' = 'Entire City') and
Status = 'active' and ".$Day." NOT LIKE 'NULL' ORDER BY Name;";
$result = mysql_query($sql);
if(!$result)
{
}