<div align="center">
<?php
// set file to read
$filename = "../teams.yaml";

$newdata = null;  
if (isset($_POST['newd']) && $_POST['newd'] != "") $newdata = $_POST['newd'];

if ($newdata != '') {

// open file 
$fw = fopen($filename, 'w') or die('Could not open file!');
// write to file
// added stripslashes to $newdata
$fb = fwrite($fw,stripslashes($newdata)) or die('Could not write to file');
// close file
fclose($fw);
}

// open file
  $fh = fopen($filename, "r") or die("Could not open file!");
// read file contents
  $data = fread($fh, filesize($filename)) or die("Could not read file!");
// close file
  fclose($fh);
// print file contents
 echo "<h3>Masters of Endurance - Team Data</h3>
<form method='post' >
<textarea name='newd' cols='100' rows='30'>$data</textarea><br>
<input type='submit' value='Submit Changes'>
</form>";

?>
</div>
