NuRunPHP -new tab opens

NuRunPHP -new tab opens

Unread postby stevem » Tue Jun 24, 2014 8:35 pm

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
stevem
 
Posts: 8
Joined: Tue Jun 24, 2014 8:29 pm

Re: NuRunPHP -new tab opens

Unread postby admin » Wed Jun 25, 2014 8:17 am

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 4421 times


3. Create a button with the following event.
onclick.PNG
onclick.PNG (24.3 KiB) Viewed 4421 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
admin
Site Admin
 
Posts: 3423
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5

Re: NuRunPHP -new tab opens

Unread postby stevem » Wed Jun 25, 2014 9:21 pm

Hello,

Thanks for the reply, it now works a treat.
Thanks again
stevem
 
Posts: 8
Joined: Tue Jun 24, 2014 8:29 pm

Re: NuRunPHP -new tab opens

Unread postby admin » Thu Jun 26, 2014 10:10 am

.
admin
Site Admin
 
Posts: 3423
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5


Return to Custom Code

Who is online

Users browsing this forum: No registered users and 5 guests