<?php
$query = (isset($_POST['query']) ? $_POST['query'] : NULL);
if($query == NULL) {
die('Please go back and enter a search string.');
} else {
header('Location: http://www.mydomain.com/' . $query);
}
?>
Obviously, you'll need to change the $_POST reference to whatever entity is submitted as well as the valid URI to redirect them to. Additionally, you may want to change the error message text - or even redirect them to an error page - if they enter an empty search term.