Re: [PHP] stripped \n

[email protected] (Matijn Woudt)
Newsgroups php.general
Message-ID <CAC_gtuNifQN7as7U7mALZ_VbcOZ61O=L-6-xhFdnVv9jVDXVDA@mail.gmail.com>
On Wed, Feb 20, 2013 at 7:16 PM, John Taylor-Johnston <
[email protected]> wrote:

> Hi,
> I have a <textarea> when submitted creates a new form with the textarea
> data in a hidden field:
>
> <input name="DPRnarration" type="text" hidden form="DPRform" value="Enter
> call
>
> narration here.">
>
> But when this new form gets resubmitted, the \n get stripped?
>
> <input name="DPRnarration" type="text" hidden form="DPRform" value="Enter
> callnarration here.">
>
> I don't get it.
>
> There is nothing in my code that is stripping the \n?
>
> <input name="DPRnarration" type="text" hidden form="DPRform" value="<?php
> echo stripslashes($_POST["**DPRnarration"]);?>">
>
> Do I need to put it in another textarea and declare it hidden?
>

An input with type=text is used for single lines, so yes, newlines get
stripped.
Either use a textarea with style="display: none", or store the data in a
session instead.

- Matijn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.