eskander wrote in php

hi
looking for a little bit of help here
i'm trying to write a script that will write to a file if a button is clicked
i got the writing down but i can't seem to get the button to activate it

so in other words i'm looking for something like:
if button = down/clicked
{
write to file;
}

is there a way to do this is php?