PDA

Click to See Complete Forum and Search --> : php $_POST problem with text spaces


Pouncer
Jun 15th, 2006, 07:49 AM
what im doing is posting the message from the previous page when the save button is clicked, and putting this message in the textbox..


if (isset($_POST['Save'])) {

$text = $_POST['textarea'];

?> <textarea align="center" name="textarea" cols="70" rows="13">
<? echo $text; ?>
</textarea>
.. blah blah



but the text appears indented in the textbox, any idea why? :confused:

john tindell
Jun 15th, 2006, 08:22 AM
instread of

<textarea align="center" name="textarea" cols="70" rows="13">
<? echo $text; ?>
</textarea>


try

<textarea align="center" name="textarea" cols="70" rows="13"><? echo $text; ?></textarea>


Because you have indented your HTML (which is good) you have added in the space on the intentation to the text of the textarea.

Pouncer
Jun 15th, 2006, 08:56 AM
ahh, i didnt know that had an effect, thanks alot!!

penagate
Jun 15th, 2006, 09:30 AM
Textareas are set to white-space: pre unlike other elements which by default discard excess whitespace.