Why input text is cut off on form submission if input string has <
sign followed by some text without space, e.g. <abc
. But it works fine when there is a space after <
, e.g. < abc
HTML
<form name="testform" method="post">
<input type="text" name="title" />
<input type="submit" value="Submit"/>
</form>
If you provide input value as This is a sample <string
and submit. Received value via POST is This is a sample
. However when you submit This is a sample < string
(notice the space after <) then it's received correctly.
Server-side (PHP)
<?php
if(isset($_POST['title'])) {
echo '<pre>';
print_r($_POST); // outputs "This is a sample " instead of "This is a sample <string"
}
?>
What's the reason for this?