Calling PHP Program Upon Form SUBMIT

  • mredmond13
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 11
  • Thank you received: 0

mredmond13 created the topic: Calling PHP Program Upon Form SUBMIT

I have a Joomla site with a menu option which calls a PHP program in an iFrame wrapper. Works great to produce a PDF report.

I now want to add some selection options prior to printing the report. I have created a simple form using BreezingForms with 3 check boxes.

I do not need the form written to a record. I want to send the selections to the PHP program and print the report using the form's data to filter data into the report.

The form is working, but I am unclear how to proceed with passing the data and calling the PHP program.
#237998
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2651
  • Karma: 92
  • Thank you received: 354

mihaela replied the topic: Calling PHP Program Upon Form SUBMIT

Hello,

You can write a PHP code that will be executed after the form is submitted in Form's Advanced properties > More options > Submit pieces. In the End Submit section set Type to Custom and a code area will appear where you will be able to write the code that you want.

You could fetch the values submitted in the form using the following code:
$this->execPieceByName('ff_InitLib');
$var1= ff_getSubmit('CHECKBOXNAME');

if($var1 == "checked") {
    // put your code here that has to be executed in case the chackbox is checked.
}
NOTE: In the code below the CHECKBOXNAME has to be replaced with the Name of the checkbox field in your form.

Let me know whether you have manged to make this work as you wanted.

Regards,

Mihaela
#238004
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2651
  • Karma: 92
  • Thank you received: 354

mihaela replied the topic: Calling PHP Program Upon Form SUBMIT

Hello,

You can write a PHP code that will be executed after the form is submitted in Form's Advanced properties > More options > Submit pieces. In the End Submit section set Type to Custom and a code area will appear where you will be able to write the code that you want.

You could fetch the values submitted in the form using the following code:
$this->execPieceByName('ff_InitLib');
$var1= ff_getSubmit('CHECKBOXNAME');

if($var1 == "checked") {
    // put your code here that has to be executed in case the chackbox is checked.
}
NOTE: In the code below the CHECKBOXNAME has to be replaced with the Name of the checkbox field in your form.

Let me know whether you have manged to make this work as you wanted.

Regards,

Mihaela
#238005
  • mredmond13
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 11
  • Thank you received: 0

mredmond13 replied the topic: Calling PHP Program Upon Form SUBMIT

mihaela wrote: Hello,

You can write a PHP code that will be executed after the form is submitted in Form's Advanced properties > More options > Submit pieces. In the End Submit section set Type to Custom and a code area will appear where you will be able to write the code that you want.

You could fetch the values submitted in the form using the following code:

$this->execPieceByName('ff_InitLib');
$var1= ff_getSubmit('CHECKBOXNAME');

if($var1 == "checked") {
    // put your code here that has to be executed in case the checkbox is checked.
}
NOTE: In the code below the CHECKBOXNAME has to be replaced with the Name of the checkbox field in your form.


Thank you for your response.
I entered the code as you suggested, with a simple echo command, to see if it would run as expected:
$this->execPieceByName('ff_InitLib');
$var1= ff_getSubmit('IncludeAddresses');

if($var1 == "checked") {
    // put your code here that has to be executed in case the checkbox is checked.
    echo "Include Addresses : " . $var1;
}

The code does appear to run (at least I do not receive an error) but a blank white screen flashes momentarily and then I am returned to the form.

I added a sleep(10) to delay script execution, thinking that perhaps the echo was working but was going by too fast for my old eyes to see. Instead, the form waits for 10 seconds and then flashes the blank white screen and returns to the form.

Any thoughts?
#238010
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2651
  • Karma: 92
  • Thank you received: 354

mihaela replied the topic: Calling PHP Program Upon Form SUBMIT

Hello again,

You have to add the following line of code to the end of your code in order for the echoed text to be displayed:
exit();

Also, I've read your first message once again. If you wish to pass values from the form to a different url this might help you crosstec.org/en/forums/3-breezingforms-f...n-form-b.html#230577 .

Regards,

Mihaela
#238011
The following user(s) said Thank You: mredmond13
  • mredmond13
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 11
  • Thank you received: 0

mredmond13 replied the topic: Calling PHP Program Upon Form SUBMIT

mihaela wrote: Hello again,

You have to add the following line of code to the end of your code in order for the echoed text to be displayed:

exit();

Also, I've read your first message once again. If you wish to pass values from the form to a different url this might help you crosstec.org/en/forums/3-breezingforms-f...n-form-b.html#230577 .

Regards,

Mihaela


@Mihaela,

Adding exit(); worked. Thank you so much.

I will review the recommended link as I get more into the details of what I am trying to do. I may be back to ask more questions. Thanks again.
#238024
Moderators: ForumSupporttomeperica
Time to create page: 0.071 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here