I have a site (php4) that uses PATH_INFO and QUERY_STRING to pass arguments thus:
$var_array = explode("/", $_SERVER["PATH_INFO"]);
$the_form = $var_array[1];
if ($the_form == "") { $the_form = $_SERVER["QUERY_STRING"]; }
Apache automatically assumes the page "viewform" ($var_array[0]) and the variable $the_form is used as an index value for a database lookup. What I need to do and haven't figured out is how, in drupal 6, to use $var_array[0] as the path value and $var_array[1] ($the_form) as an argument or parameter for a block module. I suspect the answer is in drupal_goto() but I'm currently stuck in an infinite redirect loop. In drupal QUERY_STRING looks like q=viewform/wcab4. I wish to use viewform (node/11) as the page and "wcab4" as a parameter in an SQL statement.
This is one of my attempts using code in my 404 handling page:
$var_array = explode("/", $_SERVER["QUERY_STRING"]);
if ($var_array[0] == "q=viewform") {
drupal_goto("viewform", $var_array[1], '', 302);
}