I need sanitize this part of code. I have - SQL injection proteciotn is done , but I have no idea how and where to add sanitization
[php] if(isset($_POST[‘submit’])){
try {
$conn = new PDO("mysql:host=$server;dbname=$database", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// prepare sql and bind parameters
$stmt = $conn->prepare("INSERT INTO subskrypcja (imie, email) VALUES (:imie, :email)");
$stmt->bindParam(':imie', $imie);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':imie', $_POST['imie']);
$stmt->bindParam(':email', $_POST['email']);
$stmt->execute();
echo "New records created successfully";
header('Location:subskrypcja.php');
}
catch(PDOException $e)
{
echo "Error: ";
}
$conn = null;
}
}[/php]