The Student Room Group

idea silver resolution bagde level 3

I don't know how to sanitise the variable in this code in the idea silver resolution badge level 3.

$message = $_POST['message'];
insertIntoDatabase($message);
(edited 3 years ago)
Original post by aditid
I don't know how to sanitise the variable in this code in the idea silver resolution badge level 3.

$message = $_POST['message'];
insertIntoDatabase($message);

The answer to sanitise the variable before it gets inserted into the database
should be:

$myFormData = escape_tags($myFormData);
insertIntoDatabase($myFormData)

You only need to replace the first line with the escape_tags variable and replace $message to $myFormData.
Hope this helps!

Quick Reply

Latest

Trending

Trending