Title: Form input adding .
Last modified: August 31, 2016

---

# Form input adding .

 *  [Mariah_A_C](https://wordpress.org/support/users/mariah_a_c/)
 * (@mariah_a_c)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/form-input-adding/)
 * I have a form which processes and stores the information in my database. I then
   call the information back and store it as a variable to display in the value 
   of the input, so it can be edited and updated. For testing I am also echoing 
   the the variable directly after text area for comparison.
 *     ```
       Description: <textarea name="description" rows="5" cols="40"><?php echo $description;?></textarea>
   
       <?php echo $description;?>
       ```
   
 * When the echos print the one in the testarea has a </br> which isn’t present 
   in the other echo.
 * The textarea text prints as follows
 * > Test paragraph one.
   >  Test paragraph two.
 * Where as the regular echo prints as follows.
 * > Test paragraph one.
   >  Test paragraph two.
 * This is a problem because if someone say updates their email address and doesn’t
   change the description and clicks save. It gets saved with the `<br />` in there.
 * What do I need to do to prevent the `<br />` from being added?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [Mariah_A_C](https://wordpress.org/support/users/mariah_a_c/)
 * (@mariah_a_c)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/form-input-adding/#post-7066542)
 * Format correction:
 * The textarea text prints as follows
 * > Test paragraph one.`<br />`
   >  Test paragraph two.
 *  [ancawonka](https://wordpress.org/support/users/ancawonka/)
 * (@ancawonka)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/form-input-adding/#post-7066620)
 * How are you saving the data to the database? Is the 
    in your database after 
   you save the description the first time, or only the second time?
 *  Thread Starter [Mariah_A_C](https://wordpress.org/support/users/mariah_a_c/)
 * (@mariah_a_c)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/form-input-adding/#post-7066622)
 * It only shows up when I echo it in an input. It isn’t in the database unless 
   I save again once it has been added in the input.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/form-input-adding/#post-7066628)
 * FYI, the break _is_ in the echo in both cases. When echoed normally, any HTML
   is interpreted, but when echoed inside of textareas, any HTML is not interpreted.
   View your page’s source HTML to see for yourself.
 * Which doesn’t really matter because you do not want it whether it’s displayed
   or not. I’ve no idea where it’s being inserted, other than between retrieval 
   and echo. What code is used for this? Even if the actual code is not inserting
   anything, there could be a filter being applied that adds in the breaks.
 * As a workaround, you could use `wp_strip_all_tags()` prior to echoing out the
   textarea content. Of course this would also strip links and formatting HTML as
   well, which could be a good thing, or not. If you need other HTML to be maintained,
   you could strip out only breaks with `preg_replace()`.
 * Depending on what the textarea content is ultimately used for, the inserted break
   could be beneficial. Echoing the textarea content as normal markup would require
   the breaks to be inserted. Otherwise, the original newline characters are ignored
   and the separate lines without breaks would run together. Consider this when 
   deciding to remove the altering code or work around it.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Form input adding .’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/form-input-adding/#post-7066628)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
