I need some help and advice with something
I am trying to do the following
User inputs some information into a text area this info is a few paragraphs of text with possible html tags
I want to have them submit this and for php to take all the non html portions of the text they submit and split it by each individual character and insert something inbetween each character but fotr it not to do this with any of the html tags
so a sentance "some random sentance" would be split and added such as "s-o-m-e- -r-a-n-d-o-m- -s-e-n-t-a-n-c-e-"
But if if contained html tags it should be like this
"some <br> random <br> <a href="somewhere.html">sentance</a>" would be split and added such as "s-o-m-e- <br> -r-a-n-d-o-m- <br> <a href="somewhere.html">-s-e-n-t-a-n-c-e-</a>"
However with the current script im using it messes up the html tags to be like this
"some <br> random <br> <a href="somewhere.html">sentance</a>" would be split and added such as "s-o-m-e- -<-b-r->- -r-a-n-d-o-m- -<-b-r->- -<-a- -h-r-e-f-=-"-s-o-m-e-w-h-e-r-e-.-h-t-m-l-"->-s-e-n-t-a-n-c-e-<-/-a->-"
I am currently using the followinf php5 code which works fine on just plain text but has no way of skipping html tags, it generates a text area containing a modified version of the text inputted witha - between every character but i need it to skip characters that are part of a html tag and keep the tags fully intact and working as they should
$text = $_POST['text'];
$encode1=utf8_encode($text);//first encode where $string is the supplied string
for($i; $i<$l; $i++)
$s=substr($encode1, $i, 1);//get character
$encode2=utf8_encode($b);//encode second time
echo '<center><textarea cols="80" rows="10">'.$encode2.'</textarea></center>';
Any ideas or suggestions on where to start or what to look into or sample code etc would be most appreciated
Thanks in advance