Please, this was not meant as a negative feedback.
As far as the code you posted i did not go through it. Too much to read and not knowing the structure, i.e. is this the php page used to produce the web page or is it just code in the middle or what....
Anyway constructive feedback is this:
It appears that you are only populating the form when search is empty
if ($search === '' ){
echo ('<form action="'.$self.'" method="POST"> <label>Search Value <input type="text"
name="search" / </label> <br>
<input type="submit" name="description" value="Search Text" /> <br>
</form>');
}
which will explain why the user needs to back to an empty page in order to press submit again.
Hence my previous comment, the result is put up a newly designed page without the submit button is still valid.
Maybe a solution is just to remove the check for an empty search like this (note not tested on server, just copy and paste)
echo ('<form action="'.$self.'" method="POST"> <label>Search Value <input type="text"
name="search" / </label> <br>
<input type="submit" name="description" value="Search Text" /> <br>
</form>');
if ($_POST['description']) {
echo "Your search text is: <strong>$search</string><br>";
// Assign the query
$srch="%".$search."%";
$query = "SELECT * FROM allpet_twb WHERE description LIKE '$srch' OR allpetcode LIKE '$srch'";
// Execute the query
$result = mysql_query( $query );
if (!$result){
die ("Could not query the database: <br />". mysql_error( ));
}
}
if ($_POST['apcode']) {
echo "Your Product Code text is: <strong>$search</string><br>";
// Assign the query
$srch="%".$search."%";
$query = "SELECT * FROM allpet_twb WHERE allpetcode LIKE '$srch'";
// Execute the query
$result = mysql_query( $query );
if (!$result){
die ("Could not query the database: <br />". mysql_error( ));
}
}