Hello, can anyone help? This issue seems to be browser related, since every other browser newer than Netscape 4.78 works fine. But since I am required to design for NS4+, I have to get this working.
Here's the scenario: I have a form with a textarea. I submit the textarea info and pull it back into a preview page with another textarea box by assigning a variable to the $HTTP_POST_VARS value (Due to security, I had to turn off the shortcut method). When I enter linefeeds while typing, they translate properly into most common browser versions. However, when I look at the NS4.78 (my least common denominator), all text, no matter how many line breaks I enter, do not get observed. They seem to be concatenated together within one line.
I tried functions like nl2br(), wordwrap(), str_replace(), I tried all examples within the php.net user comments for the aforementioned functions, I tried substituting in \r\n to the line breaks for Windows consideration, but Netscape 4.78 does not care! How can I get my $HTTP_POST_VAR string value to appear in my preview textarea like it appeared when it was first entered into the form?
Ironically, I can perform something like echo"hey now<br>"; and the line will break within the textarea. But hey, add the same <br> anywhere into a string, and Netscape does not acknowledge it. What's the deal!
Clearly, while NS 4.78 isn't exactly the most popular browser anymore, I still need to solve this issue. Can anyone help? See below for a dump of examples I've tried.... If this helps to create a workaround, I plan to write the string to a mySQL database after it is approved by the user, so if there's a solution using mySQL as a remedy, that'd be acceptable at this point... Thanks!!!
//from the submitted page
$dream = $HTTP_POST_VARS["dream"];
//this is usually the easiest first fix, but no go...
$dream = nl2br($dream);
// Test 1
$dream = str_replace("<br />", "\r\n<br>", $dream);
//Test 2
$dream = wordwrap( $dream, 20, "\r\n");
/Test 3 (produces error)
$newtext = ereg_replace("([]{42})","\1",$dream);
// Test 4
function limit_text($dream,$maxchar){
$split=explode(" ",$dream);
$i=0;
while(TRUE){
$len=(strlen($dream)+strlen($split[$i]));
if($len>$maxchar){
break;
}else{
$dream=$dream." ".$split[$i];
$i++;
}
}
return $dream;
}
//Test 5
$dream = eregi_replace('<br[[:space:]]/?[[:space:]]>',"\r\n", $dream);
Thanks for any help or suggestions..