onload mysql 'query' will be executed then if the visitor will hit search the mysql 'querysearch' will be executed how to do that?
<form action="default.php" method="post">
Search Within:
<select name="searchtype">
<option value="CustomerID">Customer ID</option>
<option value="CustomerName">Customer Name</option>
</select>
Search Record:
<input name="searchterm" type=ā"text" size="20"/>
<input type="submit" name="submit" value="Search"/>
</form>
$searchtype=$_POST['searchtype'];
$searchterm=trim($_POST['searchterm']);
if (!$searchtype || !$searchterm) {
echo 'ERROR';
exit;
}
if (!get_magic_quotes_gpc()){
$searchtype = addslashes($searchtype);
$searchterm = addslashes($searchterm);
}
$query = mysql_query("Select CustomerID, ClientName, DATE_FORMAT(EventDate, '%b %d, %Y') as EventDate, ColorMotiff, Event, Package, TIME_FORMAT(TimeStart,'%h:%i %p') as TimeStart,TIME_FORMAT(TimeEnd,'%h:%i %p') as TimeEnd, Contact, Balance, Subtotal from details Order by STR_TO_DATE(EventDate, '%d-%m-%y')");
$querysearch = mysql_query("Select CustomerID, ClientName, DATE_FORMAT(EventDate, '%b %d, %Y') as EventDate, ColorMotiff, Event, Package, TIME_FORMAT(TimeStart,'%h:%i %p') as TimeStart,TIME_FORMAT(TimeEnd,'%h:%i %p') as TimeEnd, Contact, Balance, Subtotal from details where ".$searchtype."='".$searchterm."' Order by STR_TO_DATE(EventDate, '%d-%m-%y')");