The Student Room Group

How to sanatize code im confused

$review = $_POST['review'];

insertIntoDatabase($review);
Reply 1
Original post by RIG J1970
$review = $_POST['review'];

insertIntoDatabase($review);


What kind of sanitization? 'htmlspecialchars()' is a simple way to prevent HTML being executed, but more intricate sanitization is generally accomplished with 'filter_var()'. You can see the PHP manual for that here, which tells you about what you can do with it. Hope that helps!
this looks like PHP

use a prepared statement or stored procedure for sanitisation

there are of course other ways where you can manually sanitise it but the most standard way is prepared statement

Quick Reply

Latest

Trending

Trending