Reputation: 3
I have one form for adding book to library (database) ...
Its my form:
<form>
<input type="text" name="title">
<input type="text" name="text">
<input type="submit">
</form>
If I use the form 'Words', the form will not be submited
I think i want this code in php :
str_replace("'", "'", '".$_POST['title']."');
But it very very hard for all characters
Upvotes: 0
Views: 107
Reputation: 1132
You can use this statement to replace all POST items
foreach ($_POST as &$post){
$post = htmlentities($post, ENT_QUOTES);
}
Or use PDO quote method to escape the quotes
foreach ($_POST as &$post)
{
$post = $your_pdo_connection->quote($post);
}
Upvotes: 1