Page 1 of 1

NuRunPHP -new tab opens

Unread postPosted: Tue Jun 24, 2014 8:35 pm
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

Re: NuRunPHP -new tab opens

Unread postPosted: Wed Jun 25, 2014 8:17 am
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 4422 times


3. Create a button with the following event.
onclick.PNG
onclick.PNG (24.3 KiB) Viewed 4422 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

Re: NuRunPHP -new tab opens

Unread postPosted: Wed Jun 25, 2014 9:21 pm
by stevem
Hello,

Thanks for the reply, it now works a treat.
Thanks again

Re: NuRunPHP -new tab opens

Unread postPosted: Thu Jun 26, 2014 10:10 am
by admin
.