Reputation: 3168
I am unsure as to how to add escape string to the $_POST['scan']
I used
$var = mysql_real_escape_string($_POST['scan']);
And then swapped it with the $_POST['scan']
in the code but it won't work. It just shows me blank screen.
foreach ($_POST['scan'] as $key => $value1) {
echo "$value1, ";
}
Upvotes: 0
Views: 78
Reputation:
try: print_r($_POST);
to see what you are getting in your post variables. Are you even passing an array via $_POST['scan'] or any data at all? As someone else alluded to, mysql_real_escape_string is to be used on a string prior to inserting into mysql, and hopefully after the string has been validated/sanitized.
Upvotes: 0
Reputation: 29985
mysql_real_escape_string($str)
is used for escaping SQL queries, not for displaying to the user. You may like to use htmlentities($str)
or htmlspecialchars($str)
instead.
Upvotes: 2