I use PHP frequently in WWB projects. I would like to be able to control formatting (font size, color) when using the echo statement within an editbox.
The statement below used within a PHP script obediently writes it to the top line on my page with proper formatting.
echo "<p> <font color=blue font face='arial' size='12pt'>($_SESSION["DocumentTitle"]) </p>";
However, when I embed it within an editbox inside a form using the statement below
<?php echo( "<p> <font color=blue font face='arial' size='12pt'>($_SESSION["DocumentTitle"]) </p>" ); ?>
The following shows up in the editbox when I run the project
<p> <font color=blue font face='arial' size='12pt'>One line simple string in blue color, arial font and font size 12pt</font> </p>
I have successfully used <?php echo("Hello World"); ?> type statements (no formatting) in editboxes before.
Can anyone unravel this mystery for me?
Much appreciated.
Harry Jones
Editbox and echo statement
Re: Editbox and echo statement
I'm not php expert, but I believe the normal css would be as such:
<p style='color:blue;font-family:arial;font-size:12pt;'>your text here</p>
or possibly just add a class and then add the class to your .css file.
<p class='demo'>your text here</p>
and then in a html box/page html add to the <head> section:
<style>
.demo{color:blue;font-family:arial;font-size:12pt;}
</style>
Using <font> is deprecated in html5.
<p style='color:blue;font-family:arial;font-size:12pt;'>your text here</p>
or possibly just add a class and then add the class to your .css file.
<p class='demo'>your text here</p>
and then in a html box/page html add to the <head> section:
<style>
.demo{color:blue;font-family:arial;font-size:12pt;}
</style>
Using <font> is deprecated in html5.
Re: Editbox and echo statement
Try something like: (I haven't tried it)
echo "<p>< font color=blue font face='arial' size='12pt'> $_SESSION['DocumentTitle']</p>";
echo "<p>< font color=blue font face='arial' size='12pt'> $_SESSION['DocumentTitle']</p>";
Last edited by MGD4me on Thu May 20, 2021 5:30 pm, edited 2 times in total.
Re: Editbox and echo statement
Am I missing something? The Editbox properties have a Style tab where you can define the font size and colour. Doesn't that work?
Brian
Edit - I should have added that you can place the php echo statement as the initial value.
Brian
Edit - I should have added that you can place the php echo statement as the initial value.
Re: Editbox and echo statement
Thanks everyone for your help. I'm an idiot. I thought I had tested Brian's suggestion and it didn't work properly but that is not the case.
Best,
Harry Jones
Best,
Harry Jones