Submission to Same Page

srthomas 14 Jan, 2011
Hi,

I've used Chrono Forms to create a page which does a number of DB Select Queries to give me info about the current month.

I'd like to improve this so it has a selection of month and year at the top and a submit button so the user can choose the month to view.

Could someone share how I can submit the month and year data to the current page so that the area under the year and month selection form shows the data. The user could then choose another year and month combination and hit submit again which would change the data shown below.

I have the page and form created, I just can't figure out the submission to the same page. Do I need to modify the action part of the form? Or is there another way within Chrono Forms? I'm asssuming that standard PHP methods for retrieveing the GET variables will work?

Thanks in advance
Steve
GreyHead 14 Jan, 2011
Hi Steve,

If you set the ReDirect URL for the form to the Form URL then it will reload and you can still access the $_POST variables in the Form HTML.

Bob
srthomas 17 Jan, 2011
Hi Bob,

Thanks for the info and I've now put that in, however the POST array is empty on display of the form for the second time after the redirect. When I use the GET method, I see my form items appended to the URL but the redirect doesn't exist. With the POST the redirect works but I have now form data.

Any ideas?
Steve
GreyHead 17 Jan, 2011
Hi Steve,

Sorry,I got that wrong :-(

Try this in the OnSubmit After box of form one:
<?php
$session = JFactory::getSession();
$session->set('posted', $_POST);
?>
and this in the Form HTML box of form two
<?php
$session = JFactory::getSession();
$posted = $session->get('posted');
?>
This will add all of the $_POST array entries into the $posted array for use in the second form.

Bob
srthomas 17 Jan, 2011
Hi Bob,

Thanks for that - worked a treat!

Cheers,
Steve
This topic is locked and no more replies can be posted.