// ensure complete form was submitted if (!isset($_POST["name"]) || !isset($_POST["item"])) { header("Location: http://www.cs75.net/lectures/4/src/lunch/lunch.php"); exit; } // open CSV file for appending $handle = fopen("orders.csv", "a"); // acquire exclusive lock flock($handle, LOCK_EX); // add order to CSV file $order = array($_POST["name"], $_POST["item"]); fputcsv($handle, $order); fclose($handle); ?>