I mean with "does not work":Normally i thought that trim strips "n". But if i enter in the input field name: "Maxn" the result is "Maxn". You can also test it. It strips not completely "n" only slash and that was irritating!
If i use trim on a string it strip all characters you post … for example:
$name = nMax Mustermann;
echo trim($name);
output: Max Mustermann
but with $_POST it strips only whitespaces … for example:
<input type="text" name="name" /> // nMax Mustermann
$name = $_POST["name"];
echo trim($name);
output: nMax Mustermann
I am trying to avoid line breaks etc.
If i use trim on $_POST it trim only whitespaces. It ignores the rest that is my Problem.Should i use something else instead of trim for a secure validation?
Hey,I am trying to code a form validation but i get a problem with the function "input_check()" on w3 website especially with the trim command. It don't trim anything.$name = test_input($_POST["name"]);function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $;}echo $name;I am thankful about any help.