Reputation: 51
I have a textarea that is part of a form that submits to a PHP file.
The problem is that when an apostrophe (’) is entered into the textarea, the corresponding REQUEST variable in PHP turns up empty ($_REQUEST['description']). If there is no apostrophe, the $_REQUEST['description'] contains the textarea text as intended. Entering punctuation like single quotes and double quotes also works but an apostrophe does not. The same problem occurs for <input type="text"></input>
as well. Is there any way to fix that?
Upvotes: 0
Views: 1979
Reputation: 6715
Try this
HTML code
<form action="cible.php" method="POST">
Group name: <input type="text" name="user">
<input type="submit" value="Submit">
</form>
PHP :
<?php
$groupname = htmlspecialchars($_POST['user'], ENT_QUOTES);
echo $groupname;
?>
It's work fine for me
Upvotes: 1