i have php script, when i executed this code, i got warning
Warning: trim() expects parameter 1 to be string, array given in home/public_html
It appears the error is in your html and not in the php.
If $_POST['First_Name']
is an array while it should not be, it is likely your html looks something like:
<input name="First_Name[]" ...>
^^ here, remove this
First of all, your IF statement is all messed up
if(!isset($_POST['First_Name']) || !isset($_POST['Last_Name']) ||
{
died('Sorry, there appears to be a problem.');
}
You start it with a bracket, you end it with an OR sign (||
). First repair that, to something like this:
if(!isset($_POST['First_Name']) || !isset($_POST['Last_Name'])){
died('Sorry, there appears to be a problem.');
}
Then, if the problem persists type in var_dump($value)
and/or var_dump($_POST)
inside the antixss()
function so it's something like this
function antixss($value){
var_dump($value); var_dump($_POST); exit();
$xss = htmlspecialchars(trim($value));
return $xss;
}
And tell us what the output is.