how to insert special character like registered symbol ®
or Copyright sign
or Trademark symbol
in database and also want to show on html page
what i have to do in both side (front end and back end), please elaborate
which function is more effective
Method 1
$_GET = array_map('trim', $_GET);
$_POST = array_map('trim', $_POST);
if(get_magic_quotes_gpc()){
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
$_GET = array_map('strip_tags', $_GET);
$_POST = array_map('strip_tags', $_POST);
}
else{
$_GET = array_map('mysql_real_escape_string', $_GET);
$_POST = array_map('mysql_real_escape_string', $_POST);
}
Method 2:
foreach ($_POST as $key=>$value)
if (!get_magic_quotes_gpc()) {
return addslashes(htmlentities(strip_tags($value),ENT_QUOTES,'UTF-8'));
}
else {
return htmlentities(strip_tags($value),ENT_QUOTES,'UTF-8');
}
//------------------------ i m confused what is difference between
htmlentities() and htlspecialchars()
and which one i have to use??
which function should be used addslashes() or stripslashes()
when insert into database?