It looks pretty much okay to me (yes name='searchValue' is the correct method).
I note the trim line should be
$searchValue = trim($searchValue);
because trim returns its result instead of modifying the original value. But since that would mean
trim($searchValue); as you have it doesn't have any effect at all, that can't be the problem
I'm guessing the "return one result/return no results" difference is more due to MySQL's MATCH ... AGAINST operators.
Welcome to the wonderful world of debugging. Having fun yet? 🙂
I have one or two suspicions that this is starting to look like a configuration problem.
Alter the script to read as follows:
// get user search input
$searchValue = $HTTP_POST_VARS["searchValue"];
$searchValue = trim($searchValue);
print $HTTP_POST_VARS['searchValue'].'<br>';
print $searchValue.'<br>';
We'll see if our searchValue is getting that far.
If everything was working, the searchValue should be printed twice, once trimmed. But in this case that shouldn't happen - because there's no chance for any more bugs between there and the $query= line.
If you do get searchValue printed twice, something is Very Wrong Indeed. My guess would be that neither get printed and something is preventing $HTTP_POST_VARS from being filled in.
So add the following line to the above snippet:
print_r($HTTP_POST_VARS);
and see exactly what it contains. If it's empty (there are supposed to be two elements, 'searchValue' and 'Submit') then something about your configuration is off. In that case, what version of PHP are you running, and what OS/Server combination (the last because rumour has it Microsoft PWS is buggy about POSTed forms)? If you're using a version of PHP >= 4.1, then $_POST[] would probably be a more appropriate choice than $HTTP_POST_VARS[], though I don't offer any claim that it would fix anything.