Page 1 of 1

Editbox and echo statement

Posted: Fri May 07, 2021 6:46 pm
by hjones43
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

Re: Editbox and echo statement

Posted: Fri May 07, 2021 7:12 pm
by crispy68
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.

Re: Editbox and echo statement

Posted: Fri May 07, 2021 10:33 pm
by MGD4me
Try something like: (I haven't tried it)

echo "<p>< font color=blue font face='arial' size='12pt'> $_SESSION['DocumentTitle']</p>";

Re: Editbox and echo statement

Posted: Sat May 08, 2021 12:01 pm
by lummis
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.

Re: Editbox and echo statement

Posted: Mon May 10, 2021 9:41 pm
by hjones43
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