Hi,
I want to take a visitor's textfield entry, and check it for two things:
if, for any reason, they've entered a ridiculously long string of
letters by holding a key down, resulting in characters extending off the page, I want to apply a wordwrap to that.
BUT, if they've entered a very long url, such as one with lots of variables,
I want that to remain intact.
I've implemented wordwrap() on the entire entry, which works fine,
but of course it breaks up any long url's. I've also tried various
wrap attributes
So I've spent the last few hours trying various permutations of
strtok and explode, with no luck.
Here's the general idea:
$display = explode($visitor_entry, "\n");
for ($i=0; $i<sizeof($display); $i++) {
if (strlen($display) > 50 && !strstr($display, "a href")) {
$display = wordwrap($display, 50, "<br />\n", 1);
}
else {
//what?
}
}
Can someone enlighten me? I've run out of things to try!
TIA