LOOK on line 3:
$handle = fopen("orders.txt, "a");
see how the text changes color after your opening quote ( " )? See how it does not change back after [font=monospace]orders.txt[/font], as you would expect it to? That's because you're missing the closing quote. It should be like:
$handle = fopen("orders.txt", "a");
Syntax highlighting helps find many, many errors like this. If your current code editor does not do this, you ought to find a new one that does.