Jump to content

[SOLVED] need help on bulleted output from textarea


pixeltrace

Recommended Posts

guys,

 

i need help

 

i have a form wherein in i have a textarea name="requirements"

example of the text i am typing there is

 

item1

item2

item3

item4

 

and this text will then be submitted and saved to my database

 

my problem now is

when i view it in my view page

 

the format of the text i typed is

 

item1item2item3item4

 

how do i fix this wherein

when i view it in my view page

the output will be

 

* item1

* item2

* item3

* item4

 

need help on this please!

 

thanks in advance!

Do you have any sort of punctuation or symbols in between the items or does it simply look like: applesorangesbananaspearsfruits?

 

If you have symbols, or you can add them, you can use explode() and then loop through the array to display them in a list.

each item should have a new line after it \n

 

you could do

 

$list = expolode("\n", $data); //i think the double quote will mater here

$count = count($list);

 

$disp = "<ul>\n";

for($i = 0; $i < $count; $i++){

$disp .= "<li>". $data[$i] ."</li>\n";

}

echo $disp .= "</ul>\n";

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.