OK, just so I'm clear...
is the sequence of events, search page ---> menu.php (generate xml)
-->detail.php ?
the search page generates a url variable, you then use this to filter your recordset to create the xml file, then redirect to the detail.php page, again filtered by the same url variable ?
i don't know of a way you can do this automatically, as i am pretty sure you cannot use a php header after your xml output.
(someone out there may know better)