Writing and reading session variables

This forum is dedicated to discussions about shopping carts/ecommerce.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
Post Reply
RobHowes1
 
 
Posts: 5
Joined: Tue Jun 02, 2015 8:29 am

Writing and reading session variables

Post by RobHowes1 » Fri Feb 26, 2016 4:58 pm

Hello

I have created a form for my user to complete and I've set the Copy Session values in fields to on. I can't find anywhere what the variables are called or how I might be able to retrieve them. The form processor says read the manual which I have. I've also checked the forum but can't find anything that helps.

I want to use the price variable in a bit of JS from stripe to enter a payment value.

This is the form which I want to submit http://www.proc2w.co.uk/instantproc2w.php Once submitted it goes to the payments page which will have the stripe JS.

Any help greatly appreciated.

Rob

User avatar
Pablo
 
Posts: 14557
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Writing and reading session variables

Post by Pablo » Fri Feb 26, 2016 5:46 pm

To which part of the Web Builder is this question related?

RobHowes1
 
 
Posts: 5
Joined: Tue Jun 02, 2015 8:29 am

Re: Writing and reading session variables

Post by RobHowes1 » Sat Feb 27, 2016 11:35 am

To the DBTS form Processor.

The text says Copy Field values in session (Multipage Form)
This will copy all the variables sent through the form, in a session array which will allow you to pass these values over to another page or script. Please look at the manual.

The manual isn't helpful. I need to be able to populate a field in some js from stripe with this variable.

User avatar
Pablo
 
Posts: 14557
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Writing and reading session variables

Post by Pablo » Sat Feb 27, 2016 11:45 am

I'm sorry I think only George (the creator of the DBTS form processor) can assist you with this.

User avatar
Navaldesign
 
 
Posts: 1052
Joined: Sat Mar 01, 2008 8:08 pm
Location: Italy
Contact:

Re: Writing and reading session variables

Post by Navaldesign » Sat Feb 27, 2016 6:55 pm

From the very first page of the manual:


The DBTS Preview is a completely customizable extension that works with the
DBTS Form Processor Extension. It will allow you to create Preview Pages and
Data Merge Confirmation Pages simply dragging the Preview Object in your pages.


So it is obvious that you should read the related section. From the manual:

Creating a Success Page that contains the submitted data (data merge):
As we have already seen, if you want your visitor’s submitted info formatted
in a table, you can simply use the DBTS Preview Object. Further info is
available with the manual of that extension. However, sometimes,
you might
prefer a free layout that will contain the submitted info
.
.... goes on with instructions.......

which is exactly what you are asking for: making the form values available in your page so you can use them, either in a free layout (in example, a salutation: Hello George where George is the value passed through the form "Name" field" or simply to make the value available in order to pass it over to a PHP script or a Javascript .

Please read the DBTS Preview object manual for further info and to understand the settings you must use. Here is a small summary:

Add the DBTS Preview object in your page where the Javascript script is. Set it NOT to display the automatically created visual output. This way the Preview extension will "read" the variables passed through the form (in the initial page) and will make them available as PHP variables.

In example, the form field "Name" will generate (automatically) a variable $Name.

To pass this as value to your Javascript, type <?php echo $Name;?> inside your Javascript code, in place of the value.
www.dbtechnosystems.com

RobHowes1
 
 
Posts: 5
Joined: Tue Jun 02, 2015 8:29 am

Re: Writing and reading session variables

Post by RobHowes1 » Sat Feb 27, 2016 7:14 pm

Thanks for the help. I had worked out the Preview bit and used it on the success page. I just can't get the JS to recognise the variable.

I'll get in touch with Stripe support.

User avatar
Navaldesign
 
 
Posts: 1052
Joined: Sat Mar 01, 2008 8:08 pm
Location: Italy
Contact:

Re: Writing and reading session variables

Post by Navaldesign » Sat Feb 27, 2016 7:20 pm

Please paste here the line of your Javascript where the variable value must be placed.
www.dbtechnosystems.com

RobHowes1
 
 
Posts: 5
Joined: Tue Jun 02, 2015 8:29 am

Re: Writing and reading session variables

Post by RobHowes1 » Mon Feb 29, 2016 8:58 am

Hi George

Thanks for your help. This is the line.

data-amount= <?php echo $EquipmentPrice;?>

I've tried all sorts of permutations. I don't for a minute think it's a problem with WB11. The real problem is probably with my lack of knowledge.

Anyway thanks for looking.

Rob

maxime
 
 
Posts: 202
Joined: Sat Apr 02, 2011 6:15 pm
Contact:

Re: Writing and reading session variables

Post by maxime » Mon Feb 29, 2016 2:33 pm

your variable seem to not be ok usually we do not use '-' in a variable:
data-amount

User avatar
Navaldesign
 
 
Posts: 1052
Joined: Sat Mar 01, 2008 8:08 pm
Location: Italy
Contact:

Re: Writing and reading session variables

Post by Navaldesign » Mon Feb 29, 2016 8:41 pm

But, is this the complete line of your Javascript ?
Also, where is your Javascript placed in the page code ? It should be AFTER the DBTS Preview object, otherwise you are calling the variable $EquipmentPrice BEFORE the DBTS Preview has retrieved it from the session variables, so it is not yet available.
Add a HTML box in your page.
Add the following code in it:

<?php
print_r($PREVIEW);
?>


This will display, in your page, the array (keys and values) that are passed in the page, so you will be able to see exactly what the variable is. Some times it is simply an uppercase first letter. Make sure to NOT clear the session values (at least temporarily, for testing purposes).

After you have fixed it and you know what you need to do, delete the HTML box.
www.dbtechnosystems.com

RobHowes1
 
 
Posts: 5
Joined: Tue Jun 02, 2015 8:29 am

Re: Writing and reading session variables

Post by RobHowes1 » Tue Mar 01, 2016 7:13 pm

Hi Naval

Thanks for your help. I've decided I need professional help. As good as WB is it can't compensate for my lack of programming skills.

Thank you very much for your time and effort!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests