assign php vairable to object
assign php vairable to object
If I have a block of text with ID = text1 how do I assign $myphpvairable to it?
Re: assign php vairable to object
Where exactly do you want to assign the variable?
What are you trying to do?
What are you trying to do?
Re: assign php vairable to object
Thanks so much for getting back to me, it is excellent how much you back your product! (I have been a customer since version 9).
I am trying to set up a web page that is heavily reliant on a database, basically a management information system for farmers.
I am pretty good with sql queries and can do complex table joins etc but only know basic php (enough to get the data in and out).
I thought the best way to dispaly would be to set up a webpage and anywhere I wanted to display a field from my database put a text box. Then using the WYSIWG WB "Page HTML" menu item insert code (at the end of the page) that replaces the default text value with the result from the mysql query.
Maybe I am going about it all wrong?
I've tried the following (both failed), though this isn't quiet what I want (just a stepping stone), I thought once I worked out how this worked then I might be able drag and drop a text field on the page, format it how I want it to display and then put something like wb_text2 = $FarmNameResult in the object html after tag.
<html>
<div id="wb_Text2" style="position:absolute;left:300px;top:200px;width:83px;height:534px;z-index:2;">
<span style="color:#000000;font-family:Arial;font-size:12px;">Double click </span>Farm Name. $FarmNameResult
</div>
</html>
<html>
<div id="wb_Text2" style="position:absolute;left:300px;top:200px;width:83px;height:534px;z-index:2;">
<span style="color:#000000;font-family:Arial;font-size:12px;">Double click </span><?php echo FarmName .$FarmNameResult; ?>
</div>
</html>
I am trying to set up a web page that is heavily reliant on a database, basically a management information system for farmers.
I am pretty good with sql queries and can do complex table joins etc but only know basic php (enough to get the data in and out).
I thought the best way to dispaly would be to set up a webpage and anywhere I wanted to display a field from my database put a text box. Then using the WYSIWG WB "Page HTML" menu item insert code (at the end of the page) that replaces the default text value with the result from the mysql query.
Maybe I am going about it all wrong?
I've tried the following (both failed), though this isn't quiet what I want (just a stepping stone), I thought once I worked out how this worked then I might be able drag and drop a text field on the page, format it how I want it to display and then put something like wb_text2 = $FarmNameResult in the object html after tag.
<html>
<div id="wb_Text2" style="position:absolute;left:300px;top:200px;width:83px;height:534px;z-index:2;">
<span style="color:#000000;font-family:Arial;font-size:12px;">Double click </span>Farm Name. $FarmNameResult
</div>
</html>
<html>
<div id="wb_Text2" style="position:absolute;left:300px;top:200px;width:83px;height:534px;z-index:2;">
<span style="color:#000000;font-family:Arial;font-size:12px;">Double click </span><?php echo FarmName .$FarmNameResult; ?>
</div>
</html>
Last edited by tristan on Mon Oct 31, 2022 9:52 am, edited 1 time in total.
Re: assign php vairable to object
In that case, you can try to place the variable directly inside the text.
Make sure you enable the option 'Do not encode HTML characters' in the properties of the text object.
Code: Select all
<?php echo $myphpvariable' ?>
Re: assign php vairable to object
OMG that easy ... looks like it was the "do not encode" flag was the thing causing me all the problems 
Thanks

Thanks

Re: assign php vairable to object
So for anyone else looking to do this ...
Query your database and fill your vairables using the <HTML> menu button (at the page level) and put your php code after the <body> tag.
For the text field put your <?php echo $myphpvairable ?> in the actual text box (not in html)
Works a treat
Query your database and fill your vairables using the <HTML> menu button (at the page level) and put your php code after the <body> tag.
For the text field put your <?php echo $myphpvairable ?> in the actual text box (not in html)
Works a treat
