473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to output string using html_entities function inside text area

5
I want to display the output of PHP echo statement on the browser. The result is output of htmlentities() function of PHP.
Expand|Select|Wrap|Line Numbers
  1. $str = "A 'quote' is <b>bold</b>";
  2.  
  3. // Expected Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;
  4.  
  5. echo "<textarea>".htmlentities($str)."</textarea>";
  6.  
  7. // Expected Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;
  8.  
  9. echo "<textarea>".htmlentities($str, ENT_QUOTES)."</textarea>";
  10.  
  11.  
Apparently, it is giving me
Expand|Select|Wrap|Line Numbers
  1. A 'quote' is <b>bold</b> 
  2.  
inside my <textarea>

Please advise.
Oct 3 '10 #1
2 1483
serdar
88
As far as I remember, you cannot use any HTML element inside textarea element at all. If you do they're considered and parsed as plain text.
Oct 3 '10 #2
kovik
1,044 Expert 1GB
The output that you are getting is exactly as you programmed it. I can only assume that you are looking for a WYSIWYG editor to allow you to actually see rendered markup in a "textarea." There are many options, such as TinyMCE and OpenWYSIWYG.

Just Google WYSIWYG editors.
Oct 4 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ScareCrowe | last post by:
Whenever I try to print a string and a variable together I get incorrect output. After echoing the variable the rest of the line is ignored. //eg. $var1 = "test"; echo "This is a " . $var1 . "!...
0
by: Drydo | last post by:
In short, is it possible to swap/change the display output of a laptop to a CRT programmatically? The scenario is that we have a laptop that at the startup of a specific application would...
5
by: Brad | last post by:
I created a base page class which sets a response filter and the filter injects additional html into the response output stream. The filter works fine and everything works as expected except for...
1
by: Mei Qin | last post by:
Hello, I created a csv file on the server. I want to display it in the browser and user can download the file to local machine. Then I will delete the file from the server. Here is my code:...
3
by: Cinaritst | last post by:
Hi This is probably the most basic question out there and I apologize before hand. None the less here goes. I am running Windows and ammplite package as server. Just doing simple programming-...
3
by: slnishath | last post by:
I want to call oracle statement for every client connection which is written using pthreads
3
by: princelindie | last post by:
Please write this html code into php echo statement. <a href="javascript:ajaxpage('test.htm', 'contentarea');">test</a>
3
dlite922
by: dlite922 | last post by:
I want to display the progress of a job (a cron job) in PHP. I can do an echo, but the result will look like this: 1%2%3%4% How do you "backspace" and over-write the percentage with the new...
1
by: 9916404403 | last post by:
How to display PDF file in browser without having any save option using Asp.net my mail id is email removed for security
3
by: xtremebass | last post by:
Hi Bytes.. I have command like this.. echo "km=cat /proc/meminfo | grep MemFree | awk '{ print $2 }' " i want to redirect this output to a file or output prompt i got printed km=cat...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.