← All field notes

engineering / May 11, 2011

Joomla! Hack - Add Query String to Chronforms Redirect URL from POST Value

I had an instance where I needed an ID Variable to be placed in the URL as a query so i could pull it down from the next page with Javascript. I wanted the URL Redirect field not to just go to…

Editorial blueprint illustration for Joomla! Hack - Add Query String to Chronforms Redirect URL from POST Value
Original Esotech field note / illustration generated for this archive
I had an instance where I needed an ID Variable to be placed in the URL as a query so i could pull it down from the next page with Javascript. I wanted the URL Redirect field not to just go to http://www.example.com/thinking.html but tohttp://www.example.com/thinking.html?xID=(ID Variable) In order do do this we need to edit chronocontact.php in components/com_chronocontact On Line 359 we find: $mainframe->redirect($cf_rows[0]->redirecturl); We concactenate the query string we want and add the POST Variable from the previous form (that i was generating with mktime() ) So we change it to : $mainframe->redirect($cf_rows[0]->redirecturl."?xID=".$_POST['xID'].""); Hope this helps some of you! Complete Modified Code: if ( !empty($cf_rows[0]->redirecturl) ) { if ( !$debug ) { $mainframe->redirect($cf_rows[0]->redirecturl."?xID=".$_POST['xID'].""); } else { echo "<div class='debug' >Redirect link set, click to test:<br /> <a href='".$cf_rows[0]->redirecturl."'>".$cf_rows[0]->redirecturl."</a></div>"; }