473,408 Members | 2,839 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,408 software developers and data experts.

Changing contents of textarea

I have a textarea on a form whose value is stored in a database. I want to
display the contents as an unordered list. At the moment I am using * to
start the line and ; to end the line in the textarea and then replacing
these characters like so:

<ul>
<?php
$features=$myrow["features"];
$search = array("*", ";");
$replace =array("\t\t<li>", "</li>\n");
$list=str_replace($search,$replace,$features);
print "$list";
?>
</ul>

Is it possible to do this without the extra characters, say by just putting
the list items on separate lines in the textarea?
--
Geoff Berrow
Jul 16 '05 #1
1 2748
Geoff Berrow <$b**@ckdog.co.uk> wrote:
I have a textarea on a form whose value is stored in a database. I want
to
display the contents as an unordered list. At the moment I am using * to
start the line and ; to end the line in the textarea and then replacing
these characters like so:

<ul>
<?php
$features=$myrow["features"];
$search = array("*", ";");
$replace =array("\t\t<li>", "</li>\n");
$list=str_replace($search,$replace,$features);
print "$list";
?>
</ul>

Is it possible to do this without the extra characters, say by just
putting the list items on separate lines in the textarea?


Hi Geoff,

Yes:

<ul>
<?php
$features = $myrow["features"];
$search = "\n";
$replace = "</li>\n\t\t<li>";
$list = str_replace($search,$replace,$features);
print "<li>".$list."</li>";
?>
</ul>

HTH;
JOn
Jul 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Free-Ed, Ltd. | last post by:
I am going nuts trying to find a paragraph in a book that described how to change the text content (HTML) in a DIV. Actually I have an array of HTML strings that I want to drop into the DIV,...
5
by: martin | last post by:
I needed a way to display calculated, multiple, changing values (numerical sums) as users interacted with the page, and do this without going back to the server to load the page again. What I...
5
by: aqualizard | last post by:
I have searched and searched and searched... Can someone please tell me how (or "if" it is even possible) to change selected text in a textarea? Specifically, say a user has highlighted "ppl"...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
1
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
0
by: vijendra | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file?I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
7
nathj
by: nathj | last post by:
Hi, I have a system, developed in PHP with a MySQL database that enables members to review events they have been to or resources they have downloaded. When they write the review the data is...
4
aryanraj
by: aryanraj | last post by:
Hi Everybody, I want to design an html file viewer, for that i have got the code to browse the file, but i am not able to read the contents of the selected file, can anybody help to open the file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.