Parsing Special Characters and Symbols from HTML Form to PHP
Posted: Mon Feb 08, 2010 11:30 am
Hi,
On the HTML Form there is an Input Field as given below:
the Action page calls a PHP page where in I am receiving the value as given below:
The Problem Area: The above code-framents work just fine only with some exception that is creating problem, namely: If we type an ' (appostrphe / single quote) mark as in don't insert then the the code line:
would display only don and would leave out everything that follows the single quote sign including the sign itself.
To resolve this problem I tried this before assigning the variable's value to the value of the note input field:
But it doesn't make things any better.
What could be the reason? How to resolve it?
On the HTML Form there is an Input Field as given below:
Code: Select all
Remarks / Note: <input type=text name="rmk" size=50 title="Example: Do not insert any media tape in Slot No. 0" />Code: Select all
$rmks = $_POST['rmk'];
$rmks = htmlspecialchars($rmks);
echo "Remarsk / Note: <input type=text size=45 name=note value='" . $rmks ."'>";Code: Select all
echo "Remarsk / Note: <input type=text size=45 name=note value='" . $rmks ."'>";To resolve this problem I tried this before assigning the variable's value to the value of the note input field:
Code: Select all
$rmks = htmlspecialchars($rmks);But it doesn't make things any better.
What could be the reason? How to resolve it?