I\'m running a PHP script and continue to receive errors like:
Notice: Undefined variable: my_variable_name in C:\\wamp\\www\\mypath\\index.php on line 10
I used to curse this error, but it can be helpful to remind you to escape user input.
For instance, if you thought this was clever, shorthand code:
// Echo whatever the hell this is
=$_POST['something']?>
...Think again! A better solution is:
// If this is set, echo a filtered version
=isset($_POST['something']) ? html($_POST['something']) : ''?>
(I use a custom html()
function to escape characters, your mileage may vary)