TOPIC:

Pass PHP variable from previous page to BF field 4 weeks 16 hours ago #250010

  • Topic Author
  • dgurevich79
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 0
Hello,

I have PHP variable, that need to be passed to BF field via $_SESSION["value"].
For this purpose, I'm using the following script (Scripts -> Initialization Script):
function ff_user_myform_init()
{
  ff_getElementByName('val').value=<?php echo $_SESSION["value"] ?>;
} // ff_user_myform_init

Unfortunately, it doesn't works. When using $_SESSION["value"] in Form pieces -> Before Form, it works fine.

Please advise what I'm missing.

Thanks!

Please Log in or Create an account to join the conversation.

Last edit: Post by dgurevich79. Reason: typo

Pass PHP variable from previous page to BF field 4 weeks 16 hours ago #250011

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2202
  • Karma: 3
  • Thanks: 198
Hi,

try this:
function ff_user_myform_init()
{
  ff_getElementByName('val').value=("<?php echo $_SESSION["value"] ?>");
} // ff_user_myform_init

Let me know if it helps

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Pass PHP variable from previous page to BF field 4 weeks 16 hours ago #250012

  • Topic Author
  • dgurevich79
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 0
Hi,

Thanks, but it doesn't helps ('val' element is empty, while it shown well in "Before Form" part).

I also did the following experiment:

function ff_user_myform_init()
{
ff_getElementByName('val').value=("<?php $tmp='a'; echo $tmp ?>");
} // ff_user_myform_init

which doesn't works as well (empty 'val' value).

BTW, when inspecting elements in browser, the "value" field of input 'val' is empty.

Please Log in or Create an account to join the conversation.

Pass PHP variable from previous page to BF field 4 weeks 16 hours ago #250014

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2202
  • Karma: 3
  • Thanks: 198
Hi,

for your experiment, you missed ";" :
function ff_user_myform_init()
{
ff_getElementByName('val').value=("<?php $tmp='a'; echo $tmp ?>;");
} // ff_user_myform_init

Also, I forgot to add ";" in the code from message above, so please try this:
function ff_user_myform_init()
{
  ff_getElementByName('val').value=("<?php echo $_SESSION["value"]; ?>");
} // ff_user_myform_init

Let me if it works now

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

Pass PHP variable from previous page to BF field 4 weeks 15 hours ago #250015

  • Topic Author
  • dgurevich79
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 10
  • Thanks: 0
Hi,

Doesn't works. Even the below doesn't works:
function ff_user_myform_init()
{
ff_getElementByName('val').value=("<?php echo 'a' ?>;");
} // ff_user_myform_init

BTW, this one is works:
function ff_user_myform_init()
{
ff_getElementByName('val').value='a';
} // ff_user_myform_init

Please Log in or Create an account to join the conversation.

Last edit: Post by dgurevich79. Reason: Clarified answer

Pass PHP variable from previous page to BF field 4 weeks 15 hours ago #250016

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2202
  • Karma: 3
  • Thanks: 198
Hi,

yes, because this second is javascript code and it works.

Give a few minutes to get this to work.

Regards,
Tihana

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.041 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!