Say I have a text area that users can type in and they want to format it with spaces and such.
Well when I insert it into the DB, it strips the spaces and the formatting.
I'm sure there is an easy fix for this, but I don't know what it is.
Any suggestions? Thanks.
[SOLVED] Keeping a text areas formatting...
Moderator: General Moderators
[SOLVED] Keeping a text areas formatting...
Last edited by jonas on Sat Jun 26, 2004 4:56 pm, edited 1 time in total.
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Code: Select all
$text = str_replace(" "," ",$_POST['text']);It's not working for me ... I dont think.
I put it in my code but when I submit a text area, first off now if its too big it says server not found (like the page wont even load) and secondly if i do a smaller submission, the text area's variable in the DB is all empty.
It's almost as if it turns the entire string to spaces but that cannot be because if I try to submit the same thing again, my submission checker for the same code kicks in and gives an error.
PS: The nbsp code on my actual server does have a & but i took it out here to show you.
I put it in my code but when I submit a text area, first off now if its too big it says server not found (like the page wont even load) and secondly if i do a smaller submission, the text area's variable in the DB is all empty.
It's almost as if it turns the entire string to spaces but that cannot be because if I try to submit the same thing again, my submission checker for the same code kicks in and gives an error.
Code: Select all
if ($Submit == "Submit Code"){
$code_text = strip_tags($code_text);
$sql_username_result = mysql_query("SELECT * from game_codes WHERE memberID='$memberID' AND code_title='$code_title'");
if (empty($code_title)){
$error = 1;
$nocodetitle = "You did not fill out a code title.";
}
if (empty($code_text)){
$error = 1;
$nocodetext = "You did not fill out a code description.";
} else {
$code_text = str_replace(" ","nbsp;",$code_text);
}