Page 1 of 1
PHP variable not showing
Posted: Thu Apr 01, 2021 9:47 am
by frafi
Hello,
in the custom form processing if have the php-code:
$var = "TEST";
in the editbox of the success page:
$var
user defined variables and the vars from hidden fields work but i cannot show this php one.
What could it be?
Franz
Re: PHP variable not showing
Posted: Thu Apr 01, 2021 11:09 am
by BaconFries
The success and error page should only be html and not contain any php due to it requiring to be processed on the server.
Re: PHP variable not showing
Posted: Thu Apr 01, 2021 11:40 am
by Pablo
PHP variables are only valid within the current context.
If you want to transfer a value from one page to another, then you will need to use cookies or sessions.
Note that this is not specific to WWB.
Re: PHP variable not showing
Posted: Thu Apr 01, 2021 10:48 pm
by frafi
thanks both for the explanation
Re: PHP variable not showing
Posted: Sat Apr 03, 2021 8:14 am
by frafi
Okay, i am now running into another problem.
The project has a page1 with an inline frame and a page2.
In page2 i have defined a php variable in the head and want to give it out in a html table in the same page.
No problem so far when i open the page2 directly, localhost/test/page2.php, the variable is shown.
Running the site from page1 and page2 is called into the iframe from a button then the variable is not there.
Something must undefine the variable.
I am new here and your advice is greatly appreciated.
Re: PHP variable not showing
Posted: Sat Apr 03, 2021 10:02 am
by Pablo
An inline frame is a different page so variables from another page are not valid.
Please note that this is unrelated to WWB. We cannot teach you how to write PHP code.
But any code that work in another program will also work with WWB.
Re: PHP variable not showing
Posted: Sat Apr 03, 2021 2:14 pm
by frafi
My post was not clear enough.
My code works well in the page2.php. localhost\test\page2.php manually started.
Loading it in the iframe frome page1 the vars are gone.
The code in page2.php have not changed.
Why?
Re: PHP variable not showing
Posted: Sat Apr 03, 2021 3:30 pm
by Pablo
Without knowing the code, it will be difficult to say anything meaningful about this.
Note however that this has nothing to do with WYSIWYG Web Builder.