nbsp in Text box problem, when I use a text box to insert data into the php table, whenever I put a space, such as "Hello how are you?" It becomes "Hello nbsp how nbsp are nbsp you?" and the message displays as "Hello how are you?" <<< so there are 2 spaces between the words instead of one. (This is a chatroom script, where a message is typed into a text box and inserted into the php table). I checked the code and even restored from backup, I have never had this problem before, I think there may be something wrong in the PHP table, but im not sure? help please!
the code is:
if (isset($_POST["chat"])) {
$safecontent = makesafe($_POST["chat"]);
if ($safecontent == "" || $safecontent == " ") { //do nothing.
} else { $insert = doquery("INSERT INTO {{table}} SET id='',posttime=NOW(),author='".$userrow["name"]."',chat='$safecontent'", "chat"); }
header("Location: chat.php");
die();
}
since I cant put double spacing in yahoo message,
X = space
so to rephrase, the message comes out to be: "HelloXXhowXXareXXyou?" << so there are two spaces inbetween words
Not sure what a strip() function is, but no, I'm not.
what do you mean by a "?"?
any messages separated a space has the double spacing, and yes I am using these:
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
$_POST = array_map('addslashes_deep', $_POST);
$_POST = array_map('html_deep', $_POST);
$_GET = array_map('addslashes_deep', $_GET);
$_GET = array_map('html_deep', $_GET);
$_COOKIE = array_map('addslashes_deep', $_COOKIE);
$_COOKIE = array_map('html_deep', $_COOKIE);
function stripslashes_deep($value) {
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
function addslashes_deep($value) {
$value = is_array($value) ?
array_map('addslashes_deep', $value) :
addslashes($value);
return $value;
}
function html_deep($value) {
$value = is_array($value) ?
array_map('html_deep', $value) :
htmlspecialchars($value);
return $value;
}
the code is:
if (isset($_POST["chat"])) {
$safecontent = makesafe($_POST["chat"]);
if ($safecontent == "" || $safecontent == " ") { //do nothing.
} else { $insert = doquery("INSERT INTO {{table}} SET id='',posttime=NOW(),author='".$userrow["name"]."',chat='$safecontent'", "chat"); }
header("Location: chat.php");
die();
}
since I cant put double spacing in yahoo message,
X = space
so to rephrase, the message comes out to be: "HelloXXhowXXareXXyou?" << so there are two spaces inbetween words
Not sure what a strip() function is, but no, I'm not.
what do you mean by a "?"?
any messages separated a space has the double spacing, and yes I am using these:
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
$_POST = array_map('addslashes_deep', $_POST);
$_POST = array_map('html_deep', $_POST);
$_GET = array_map('addslashes_deep', $_GET);
$_GET = array_map('html_deep', $_GET);
$_COOKIE = array_map('addslashes_deep', $_COOKIE);
$_COOKIE = array_map('html_deep', $_COOKIE);
function stripslashes_deep($value) {
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
function addslashes_deep($value) {
$value = is_array($value) ?
array_map('addslashes_deep', $value) :
addslashes($value);
return $value;
}
function html_deep($value) {
$value = is_array($value) ?
array_map('html_deep', $value) :
htmlspecialchars($value);
return $value;
}