Saving Tabs in POST Data

I need to save tabs from a text field through POST Data. It seems like there is no way to differentiate tabs from spaces in the $ _POST array, and that really upsets me.

I am using jQuery plugin from here to use tab and move + tab in textbox. http://teddevito.com/demos/textarea.html

The jQuery plugin uses this as its Tab character:

$.fn.tabby.defaults = {tabString : String.fromCharCode(9)};

For some reason, it displays a separate space instead of each tab character, so all my code formatting is lost:

<textarea name="field0" rows="26" cols="123"><?php
    echo $_POST['field0'];
?></textarea>

This also does not work. The tabs seem to disappear before the data even reaches the str_replace function (the first double quotes are the result of when I press TAB in a text editor):

<textarea name="field0" rows="26" cols="123"><?php
    echo str_replace("    ", "\t", $_POST['field0']);
?></textarea>

, , , , - .

- ? , javascript POST, , .

+3

All Articles