<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt;color:#7f003f;"><DIV><FONT face="arial, helvetica, sans-serif">I have a function that is working fine with query parameters to filter the data, but the customer wants a form to enter the date selections. The form is no problem. But just to make it easier for me, I want the form to set the query parameters and return to the orignal function (menu item) so I don't have to re-code a lot. </FONT></DIV>
<DIV><FONT face="Courier New, courier, monaco, monospace, sans-serif" size=2>function stats_form_submit($form, &$form_state) {<BR> $start = implode('-', $form_state['values']['start_date']);<BR> $end = implode('-', $form_state['values']['end_date']);<BR> $g = $_GET;<BR> unset($g['q']);<BR> $g['start'] = $start;<BR> $g['end'] = $end;<BR> $r = '';<BR> $sep = '';<BR> foreach ($g as $key => $value) {<BR> $r .= "$sep$key=$value";<BR> $sep = '&';<BR> }<BR> drupal_set_message("going to $r");<BR> $form_state['redirect'] = url($_GET['q'], array('query' => $r));<BR> drupal_set_message(print_r($_SESSION, true));<BR>}<BR></FONT></DIV>
<DIV><FONT face="arial, helvetica, sans-serif"><FONT face="arial, helvetica, sans-serif">When I do this several weird things happen. First, there is an extra slash in the URL; i.e. instead of "stats/6?end=8-31-2010", I get "/stats/6?end=8-31-2010" (of course with the usual garbagy encoding). I don't know if that is the reason, but te second problem is that the tid (6 in this example) passed from the menu now includes the query string, making it fail the numeric test and not setting $_GET['end'].</FONT></FONT></DIV>
<P><FONT face="arial, helvetica, sans-serif"><FONT face="arial, helvetica, sans-serif"></FONT></FONT> </P>
<P><FONT face="arial, helvetica, sans-serif"><FONT face="arial, helvetica, sans-serif">Is there a better, safer way to return the submitted form data as a query string?</P>
<DIV><BR></FONT> </FONT></DIV>
<P><FONT face="bookman old style, new york, times, serif" color=#ff007f size=4><EM><STRONG>Nancy</STRONG></EM></FONT></P>
<P> </P>
<P><FONT face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</FONT></P>
<DIV></DIV></div></body></html>