• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Sending variables to consecutive forms

Sending variables to consecutive forms 17 years 4 months ago #1412

  • ilan
  • ilan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
I want our visitors to fill in a form, and on submit, I want them to arrive to a second form but \"carrying on\" some of the values inserted in the first form.

For example the user provides his name and email in the first form, and then on submit he's sent to the second form. On submit of this second form I want to send to the user a confirmation email, so I would need the name and email available (possibly as hidden fields).

I tried playing a little bit with the solution on:

http://www.rsjoomla.com/index.php?option=com_kunena&Itemid=41&func=view&id=1385&catid=2#1385

but with no success.

Any help would be highly appreciated.
The administrator has disabled public write access.

Re:Sending variables to consecutive forms 17 years 4 months ago #1419

  • alex
  • alex's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 443
  • Thank you received: 3
Hello ilan,

let's assume you have 2 forms, form1 and form2.

In the form1, you define an e-mail address field with field id = email
in the form 2, define a hidden field, with field id = email

In the form1, add this script in Scripts called on form process:
if(isset($_POST['form']['email'])){
    $_SESSION['form2']['email']['default_value'] = $_POST['form']['email'];
}

In the form2, add this script in Scripts called on form display(not process):
if(isset($_SESSION['form2'])){
    foreach($fields as $i=>$field){
        if($field->name=='email') $fields[$i]->default_value = $_SESSION['form2']['email']['default_value'];
    }
}

That's it.
The administrator has disabled public write access.

Re:Sending variables to consecutive forms 17 years 4 months ago #1470

  • ilan
  • ilan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
I'm not being able to make this code work, apparently the session variables are not being set.

After setting the code in form1 at the form process scripts, I made the following test in form2 at the form display scripts:
if(isset($_SESSION['form2'])){
echo \"<br>session from2 is set<br>\";
    foreach($fields as $i=>$field){
        if($field->name=='emailaddress') $fields[$i]->default_value = $_SESSION['form2']['emailaddress']['default_value'];
    }
}
 
echo \"session form2 email address:\". $_SESSION['form2']['emailaddress']['default_value'] . \" <br> session form2:\". $_SESSION['form2'] .\" .\";

The first echo is never printed, and the second echo does not print any of the variables.

Any ideas on how to find is the session variables on the first form are really being set?

Thanks again
Ilan
The administrator has disabled public write access.

Re:Sending variables to consecutive forms 17 years 1 month ago #2400

  • ilan
  • ilan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Assuming this was a sessions-handling problem I searched the joomla forum and found a possible answer, so before applying it, I tested again my old forms that had this solution and, SURPRISE, they worked fine!!!

From these postings till now I updated both joomla from 1.013 to 1.0.15 and RSform to version 1.0.4 so I guess that there was some kind of bug in one or both of them, and now it got fixed.

So to everyone, this solution does work!!!

Thanks
Ilan
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!