Hi everyone,
I want to pass value from text area box.
Now, everytime the person hit the enter button inside the text area,
it will create special invisible characters for it.
Now, how do I eliminate this? Because when I want to pass it to
the socket communication, it breaks the value and ends with M.
I have this code for the html:
.
.
.
<INPUT TEXT=\"test1\" SIZE=30>
<TEXTAREA NAME=\"test2\" ROWS=3 COLS=37>
<INPUT TEXT=\"test3\" SIZE=30>
.
.
.
Now if the user input:
in text box($test1):
test one
in textarea ($test2):
this is line 1
this is line 2
in text box($test3):
test three
Then, the user click submit and goto other php page. In that page, I pass the value of form variables to the socket communication with these codes:
$pass_value = \"\\"$test1\\" \\"$test2\\" \\"$test3\\" \";
$connect = fsockopen(\"192.168.1.30, 9999);
fgets($connect, filesize($connect));
fwrite($connect, $pass_value);
fclose($connect);
Those codes will send the value of $test1, $test2, and $test3 to the other computer with socket communication on port 9999.
Now everytime there is 2 lines or more in text area, then the value that being sent:
\"test one\" \"this is line 1M
I tried to do with:
ereg_replace(\"M\", \" \", $pass_value) // for replacing M with an empty space
but it didn\'t work.
I tried:
$test2 = nl2br($test2);
it gave me:
\"test one\" \"this is line 1M<br>
I can replace br with:
$return = \'<br>\';
$test2 = ereg_replace($return, \" \", $test2);
How do I replace M?
Anyone know the solution for this?
Thanks.
Mike