Adding html tags to form input and save in database
I use this to get info from post values and save it to database. The problem is that it doesnot add html tags like <br /> or <strong> to database. What am I doing wrong?
Thanks
PHP Code:
<?php //Connect to database, all incoming posts from sql injection
$cat= new mysql($db_host, $db_user, $db_password, $db);
$cat->connect(); $cat->select();
foreach($_POST as $key=>$value)
{
if (PHP_VERSION < 6 && get_magic_quotes_gpc())
{
$_POST[$key]=stripslashes($value);
}
$_POST[$key] =mysql_real_escape_string($_POST[$key]);
}
echo $query = "INSERT INTO table (id, name)
VALUES ('".$_POST['id']."', '".$_POST['name']."')"; ?>
|