Can i pass the form data to another form

guessnoww 03 Jul, 2008
Hello every one i'm new with this!
here is what i need , i want one form to accept info from users then after been submitted it is redirect to another form can i pass some of the data from the previous data to this form ? if yes help please:(
GreyHead 03 Jul, 2008
Hi guessnoww,

Yes, I'd probably do this by creating a single ChronoForms form that contained both html forms and a little php to show one or the other. Otherwise you have to find a way to pass the data over, the safest is probably to write it into a database table and re-read it from the second form but other methods: cookies, session data, temporary files or adding to url can all be made to work.

Bob
guessnoww 04 Jul, 2008
Thanks for your support BOB i am really new with this can i have the how to of your options (the tiny php code to control the forms and attaching variables to the url)
Thanks again
GreyHead 04 Jul, 2008
Hi guessnoww,

Here's one way of putting two forms in one.
<?php 
if ( $_POST['last_form'] == "" ) {
?>
  // show basic form
  <input type="hidden" name="last_form" value="1" />
<?php
} elseif ($_POST['last_form'] == 1 {

  echo "Your name is $_POST['name']";
  . . .
}
?>
this is much simplifed to give you an idea. The code needs expanding and testing to work in practice.

Bob
nbriones 13 Jul, 2008
Hi.. how can you pass values using session?

What i have done, is to modify index.php, adding the next code:

/**
* DISPATCH THE APPLICATION
*
* NOTE :
*/
$option = JRequest::getCmd( 'option' );


// ********* Added code ***********
if ( $option=="com_chronocontact" )
{
session_start();
$_SESSION['post']=$_POST;
}
// ********* Added code ***********


Then, inside a form, i try to use $_SESSION['post'], but nothing happens. I know $_SESSION['post'] has the $_POST array inside index.php, but inside the form, the session seems to be cleaned up.

Any help would be nice...

Regards,

Nicolas
nbriones 13 Jul, 2008
I tried also the first solution, but when it reload the same form, the $_POST array is empty.

I create the form, and i set the "Redirect URL:" to the same form (i copied and pasted the URL from the "Forms Management", under the Link column), but nothing happens...
scspl_krunal 09 Jan, 2012
Hi,

I am using multipage plugin for form for creating 3 forms. I need to pass all element information from 1st form to second form and then collect elements of 2nd forms and send both forms element to final (3rd steps) and store all information in database single table.

I don't required to stores all forms in separate tables.

Also i used by putting following code into form1 (mother form) onSubmit event before email.


  if ( !$mainframe->isSite() ) { return; }
     $session =& JFactory::getSession();
     $posted = $session->get('personalization_from', $_POST,md5('chrono'));
			$session->set('posted', $posted);


And tried to fetch it in 2nd form by putting following line in top of HTML.


$posted = $session->get('personalization_from', array(),md5('chrono'));
print_r($posted);


But i am not getting elements of first form in second form.

I am using 3.1 version.

Please do needful.

Thank you,
KrunaL
GreyHead 09 Jan, 2012
Hi scspl_krunal,

Your post suggests that you are using some quite old code from ChronoForms v3 in a ChronoForms v4 form?

CFV4 has 'Data to Session' and 'Session to Data' actions that will do this work for you.

Bob
This topic is locked and no more replies can be posted.