What are potential security risks associated with using $_GET in PHP code?

Using $_GET in PHP code can expose your application to security risks such as SQL injection and cross-site scripting attacks. To mitigate these risks, it is important to properly sanitize and validate any data coming from the $_GET superglobal before using it in your application.

// Sanitize and validate input from $_GET before using it
$param = isset($_GET['param']) ? htmlspecialchars($_GET['param']) : '';