Why is there an underscore for data_?
Is there a simpler way of writing this, so that it makes more sense in terms of code readability?
My analysis:
data_ is supposed to take whatever data_ is, request a message via the variable postmessage from the form and make sure it’s text and concatenate all this:
$filename = 'data_'.$_REQUEST['postmessage'].'.txt';
I am a beginner and my analysis of this code could be wrong, but I am willing to learn from my mistakes.
Let’s break it down a bit:
$filename.$_REQUESTtoo often, unless you absolutely have to. Use$_GETor$_POSTinstead). This would come from your form (as you’ve mentioned).A dot between the elements above is used to concatenate the strings.
About your comment “and make sure it’s text” – wrong. It doesn’t make sure it’s text. You need to make sure of that yourself and you probably should (for security reasons).