What are some common pitfalls to avoid when working with PHP to display content in specific sections of a webpage using include statements?

One common pitfall to avoid when working with PHP to display content in specific sections of a webpage using include statements is forgetting to properly sanitize user input to prevent potential security vulnerabilities such as cross-site scripting attacks. To solve this issue, always sanitize any user input before including it in your webpage.

<?php
// Sanitize user input before using it in include statement
$section = filter_var($_GET['section'], FILTER_SANITIZE_STRING);

// Include the specific section based on user input
include "sections/{$section}.php";
?>