This is my first participation is this great website, so I hope to get the first great answer to my question. I'm using the following code to insert data into MySQL database:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2"))
{
$q = $conn->prepare("INSERT INTO client (name, address) VALUES (:name, :address)");
$q->bindValue(':name', htmlspecialchars($_POST['name']), PDO::PARAM_STR);
$q->bindValue(':address', htmlspecialchars($_POST['address']), PDO::PARAM_STR);
$q->execute();
}
Is the insertion secure enough? Should I use htmlspecialchars() the moment of insertion or rhe moment of displaying data?
Kind regards