<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&nbsp;a form to enter the date selections. The form is no problem. But just to make &nbsp;it easier for me, I want the form to set the query parameters and return to the orignal function (menu item)&nbsp;so I don't have to re-code a lot.&nbsp;</FONT></DIV>
<DIV><FONT face="Courier New, courier, monaco, monospace, sans-serif" size=2>function stats_form_submit($form, &amp;$form_state) {<BR>&nbsp; $start = implode('-', $form_state['values']['start_date']);<BR>&nbsp; $end = implode('-', $form_state['values']['end_date']);<BR>&nbsp; $g = $_GET;<BR>&nbsp; unset($g['q']);<BR>&nbsp; $g['start'] = $start;<BR>&nbsp; $g['end'] = $end;<BR>&nbsp; $r = '';<BR>&nbsp; $sep = '';<BR>&nbsp; foreach ($g as $key =&gt; $value) {<BR>&nbsp;&nbsp;&nbsp; $r .= "$sep$key=$value";<BR>&nbsp;&nbsp;&nbsp; $sep = '&amp;';<BR>&nbsp; }<BR>&nbsp; drupal_set_message("going to $r");<BR>&nbsp; $form_state['redirect'] = url($_GET['q'], array('query' =&gt; $r));<BR>&nbsp; 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>&nbsp;</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>&nbsp;</FONT></DIV>
<P><FONT face="bookman old style, new york, times, serif" color=#ff007f size=4><EM><STRONG>Nancy</STRONG></EM></FONT></P>
<P>&nbsp;</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>