Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

NuRunPHP -new tab opens

Locked
stevem
Posts: 8
Joined: Tue Jun 24, 2014 12:59 pm

NuRunPHP -new tab opens

Unread post by stevem »

Hi,
Would it be possible to confirm if there is a way of running PHP code without a new browser tab opening?
I have a button on a database form that has an onclick event that calls
nuRunPHP('newid');

The php code within newid runs a SQL update on a table.

The issue I'm seeing is that the code runs fine, but it creates an additional tab each time it runs. Is there anyway of either not opening the new tab or close the tab after the codes completes?

Thanks
Steve
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: NuRunPHP -new tab opens

Unread post by admin »

stevem,

Here is an example of how you can run php in one of nuBuilderPro's iFrame Objects.

1. Create a PHP Code record with
the Code zzz
the PHP..

Code: Select all

print "

<html>
  <body style='background-color:red'>
  </body>
</html>

";

//-- remove the HTML and the iFrame will not be visible

if('#bob#' == 'world'){

   print ' hello #bob#  ';
   
}
2. Create an iFrame Object on a Form with the name testphp.
iframe.PNG
iframe.PNG (16.8 KiB) Viewed 5116 times
3. Create a button with the following event.
onclick.PNG
onclick.PNG (24.3 KiB) Viewed 5116 times

Code: Select all

nuSetHash('bob', 'world');
nuRunPHP('zzz', 'testphp');
NOW zzz will be run as the Form loads but because it doesn't know #bob#, we stop it from doing anything.

Each time you click your button, zzz will be run without opening another tab.


Steven
stevem
Posts: 8
Joined: Tue Jun 24, 2014 12:59 pm

Re: NuRunPHP -new tab opens

Unread post by stevem »

Hello,

Thanks for the reply, it now works a treat.
Thanks again
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: NuRunPHP -new tab opens

Unread post by admin »

.
Locked